Roubles wrote:
Hi All,
Quick question; what is the difference between initializing and
clearing a structure like this:
mystruct_t a = {0};
and initializing and clearing it like this:
mystruct_t a;
memset(a, 0, sizeof(mystruct_t));
In practice, probably not much.
However, suppose the first element of the struct were a pointer, and
you are on a system where a NULL pointer is not all-bits-zero.
Also, my understanding is that _all_ entries will be set to their zero
representation, which may not be all-bits-zero. (For example, a "double"
value.)
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody |
www.hvcomputer.com | |
| kenbrody/at\spamcop.net |
www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+