Tuesday, March 20, 2012

c++ - What Does {0} Mean in C? - Stack Overflow

c++ - What Does {0} Mean in C? - Stack Overflow: "One thing to be aware of is that this technique will not set padding bytes to zero. For example:

struct foo
{
    char c;
    int  i;
};

foo a = {0};
Is not the same as:

foo a;
memset(&a,0,sizeof(a));
In the first case, pad bytes between c and i are uninitialized. Why would you care? Well, if you're saving this data to disk or sending it over a network or whatever, you could have a security issue."

'via Blog this'