Is there any compiler setting or other way to force an int to be initialized to 0?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately, there is no way in the language and if the compiler offers such a setting it goes against the standard and therefore should not be used.
May I ask why you need this? Is explicit initialization not enough? Or would you like to be warned when uninitialized memory i used? The latter can be achieved using
valgrind‘s memory profiler.