If in optimization mode, if your class or POD structure (has only POD types) and the constructor is not specified, any C ++ compiler of production quality not only misses the call to the constructor, but does not even generate it.
If your class has non-POD members that must be called by constructors, the compiler will generate a default constructor that calls member constructors. But even then - it will not initialize POD types. That is, if you do not explicitly initialize member , you may end up with garbage there.
All this can even become a fantasy if your compiler / linker has LTO.
Hope this helps! And first do your work on the program, then use the profiler to detect slow spots, and then optimize it. Premature optimization can not only make your code unreadable, but also unnecessary blood clots of your time, but it may also not help at all. You should know what to optimize first.
Here is the code parsing in your example (x86_64, gcc 4.4.5):
main: subq $8, %rsp movl $4, %edi call _Znwm movl $4, %edi movl $0, (%rax) call _Znwm movl $4, %edi movl $0, (%rax) call _Znwm movl $400, %edi movl $3, (%rax) call _Znam xorl %eax, %eax addq $8, %rsp ret
As you can see, no constructors exist at all. There are no classes at all, each object is only 4 bytes.
With MS compiler, YMMV. Therefore, you need to check the disassembly yourself. But the result should be similar.
Good luck