Re: NULL and zeros
- From: Eric Sosman <esosman@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 02 Oct 2006 23:25:56 -0400
Yevgen Muntyan wrote:
Hey,
Are there not highly specialized and still existing and used platforms
where NULL is not a sequence of zeros, so that "char *a = NULL;" and
"char *a; memset (&a, 0, sizeof (a));" are not equivalent?
In other words, do I care about possible difference between NULL and
zero-filled pointer if e.g. I assume the target platform can run X
or it is Windows?
Have you read Question 5.17 in the comp.lang.c Frequently
Asked Questions (FAQ) list at <http://c-faq.com/>?
Also, have you read the tenth of the Ten Commandments for
C Programmers at <http://www.plethora.net/~seebs/c/10com.html>?
It takes a tiny bit more effort to zero your pointers portably
than to just use calloc() or memset() and hope for the best -- but
the additional effort *is* tiny, after all! It is unlikely that you
will run across a machine where all-bits-zero is not a null pointer;
it is also unlikely that your house will burn down, yet most people
I know pay for fire insurance. Keep in mind that fashions come and
go in our industry; it would be risky to assume that progress has
ceased and that machines of the future will be just like those of
today.
--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxx
.
- Follow-Ups:
- Re: NULL and zeros
- From: Frederick Gotham
- Re: NULL and zeros
- From: Yevgen Muntyan
- Re: NULL and zeros
- References:
- NULL and zeros
- From: Yevgen Muntyan
- NULL and zeros
- Prev by Date: NULL and zeros
- Next by Date: Re: NULL and zeros
- Previous by thread: NULL and zeros
- Next by thread: Re: NULL and zeros
- Index(es):
Relevant Pages
|