[Madlug] Maybe a stupid question on editing files.
jnelson-madlug at jamponi.net
Thu Jan 22 14:26:24 CST 2004
On Thu, 22 Jan 2004, Paul Hebble wrote:
> On Thu, Jan 22, 2004 at 01:41:19PM -0600, Jon Nelson wrote:
> > To be entirely too pedantic, NULL is a pointer to void, more commonly
> > expressed as a pointer of type char to void (often, but not always
> > zero). Technically, what you mean to use is ASCII NUL (one ell), which
> > is defined as ASCII 0x0. The confusion results from the fact that the
> > names are pronounced the same, and they have the same "value", despite
> > being different types (one is char, the other is a pointer to type
> > char). On x86 machines, a char can be stored in 8 bits, a pointer in
> > 32, although obviously x86-64 is a whole different beasty. Beasty is a
> > funny word. I wonder, is the size of (char *) on x86-64 64 or 32 (bits).
> Not to put too fine a point on it, but that sounds like absolute hooey to me.
> Can you cite any "authoritative" sources to back up this idea? Because 'man
> strcpy', at least, disagrees:
> The strncpy() function is similar, except that not more
> than n bytes of src are copied. Thus, if there is no null
> byte among the first n bytes of src, the result will not be
> In the case where the length of src is less than that of
> n, the remainder of dest will be padded with nulls.
Rule #93b - man pages are never entirely correct. Especially in Linux.
And secondly, "Hooey" sounds more like "Phooey" than it does to what I
Thirdly, "which part" sounds like hooey? The size of various gritty
bits of C (pointers vs. shorts vs. integers. vs...), or NUL vs null vs.
NULL vs. 20/20 vs. Kate Winslet?
On to some substance (if horribly off-topic):
(All-lowercase) null usually means the same thing as NUL (aka NIL).
However, it should *always* be used in the following context, "the null
character". Eliminate the preceding and following words and you have an
ambiguous noun. Thusly, NUL and NIL, while less *common* (but no less
correct) are preferred for unambiguously identifying "the null
character" (0x0, '\0', etc...)
Indeed, the C99 standard *always* refers to NUL as "the null character",
however among programmers of any reasonable experience with C, you will
find some that use "NIL" in spoken conversation (again, ambiguity), or
"the null character". NULL (all caps) always refers to the pointer
variation. Consider this: "NUL" (aka "NIL") is a single word (printed
versus spoken) that means the same thing as "the null character".
Again, it's just pedantry.
Oh. Yeah. Read the comp.lang.c FAQ (it's in there somewhere, although
there are a few versions around and they vary somewhat). I also recall
this from college and various textbooks.
You may also read:
I don't want to dig anymore.
Carpe diem - Seize the day.
Carp in denim - There's a fish in my pants!
Jon Nelson <jnelson-madlug at jamponi.net>
More information about the Madlug