Suppose I have some legacy code which cannot be changed unless a bug is discovered, and it contains this code:
bool data[32
No. It is not safe (or more specifically, portable). However, it likely works by virtue of the fact that your typical implementation will:
memset() can deal with.However, best practice would dictate using bool data[32] = {false} - additionally, this will likely free the compiler up to internally represent the structure differently - since using memset() could result in it generating a 32 byte array of values rather than, say, a single 4 byte that will fit nicely within your average CPU register.