Re: NULL and zeros



Yevgen Muntyan wrote:
I am not writing code which depends only on C library. In this case
Yes, those init() functions are very easy to find, no problem
with that. But having useless lines of code is a problem. It is useless,
you know it's useless, so naturally you stop caring about it (not
intentionally, no, you are good person, it's just laziness and such)
and you need to remember about portability and force yourself to do the
"right" thing. It's much easier not to make "bad" things when you know
they actually hurt someone, you know.

How is:

x->p = NULL;

Useless?

If anything, it's more useful than:

x = calloc(1, sizeof *x);

I presume you're tying "useless" to "unnecessary." If it really bothers you
all that much, #ifdef it out by doing a NULL = (void *)0 check somewhere
else. Otherwise you're sweating the small stuff and probably pre-optimizing
somewhere. Go for portability.
.