Zero-Initialize array member in initialization list
问题 I have a class with an array member that I would like to initialize to all zeros. class X { private: int m_array[10]; }; For a local variable, there is a straightforward way to zero-initialize (see here): int myArray[10] = {}; Also, the class member m_array clearly needs to be initialized, as default-initializing ints will just leave random garbage, as explained here. However, I can see two ways of doing this for a member array: With parentheses: public: X() : m_array() {} With braces: public