Message from C, C++ discussions

November 2019

— Why not


Why in c++ when i have a char[10] in a class for example in constructor i should initialize the char[10] because is autogeneraed?

— You shall initizialize variables before you use them otherwise the value might be indeterminate

— Yeah but no errors everything works when the constructor without parameters is called

— In case of doubt whenever you intitialized everything before use, valgrind is your friend

— Can you provide an example?

— You will not run into problems with 25 lines of codes, but if you have 25k line of code, uninitialized memory you expect to be initialized will hurt you back

Message permanent page

— I have 10 classes each in separate file

— Is it necessary to use pragma once?

— Any proofs?


— Learn some manners, dude