Search code examples
c++performanceinitializationbuilt-in-types

0 initialization of C++ built-in types


suppose I have this struct (or class, my question applies to both):

struct builtin 
{ 
    int a;
    int b; 
    builtin() : a(), b(0) { } 
};

I know that both a and b will be initialized to 0 by the constructor of builtin. My question is: Is one method faster than the other?


Solution

  • Answer: no. The compiled code is identical.