I originally wrote some code like this:
class Foo
{
public:
Foo() : m_buffer()
{}
private:
char m_buffer[1024];
};
Someone who is smarter than me said that having the m_buffer() initializer would zero out the memory. My intention was to leave the memory uninitialized. I didn't have time to discuss it further, but it piqued my curiosity.
Previously, I had thought it was wise to always list each member in the initializer list.
Could someone please describe this behavior further?
1) Why does the empty-paren initializer fill in memory?
2) Does it only hold for POD datatypes? I heard that it was so, but don't have the standard handy.
Thanks