Nice() in Sys V.4
Jim Balter
jim at segue.segue.com
Thu Mar 28 21:31:06 AEST 1991
In article <11478 at dog.ee.lbl.gov> torek at elf.ee.lbl.gov (Chris Torek) writes:
>The C language definition guarantees only that:
>
> * the integer constant 0, cast to any pointer type, produces a
> valid pointer value that compare unequal to the address of any
> valid of that type (including objects created via a successful
> call to malloc());
Note, though, that ANSI does (unfortunately) allow malloc(0) to return NULL.
But then that's not an object, since objects can't have 0 size (another
unfortunate ANSI position, IMO), so your statement is technically correct.
>and a few other minor points. It specifically does NOT say that any
>particular null pointer has the same bit pattern as any other
>particular null pointer, nor that any particular null pointer has the
>integer value 0.
What you say is true, but note that many many programs use memset or calloc
to clear arrays or structures that contain pointers. Too bad you can't say
aggregate = 0;
C implementations that use something other than a zero bit pattern for NULL
pointers, aside from indicating bad judgement, are likely also to be
non-conforming, if they use BSS or the equivalent for
void *foo[100000];
since ANSI requires that it be the same as
void *foo[100000] = {0, ... repeated 100000 times};
>If you do not believe that the phrase `a zero pointer' is misleading,
>read comp.lang.c for a few weeks, or comp.unix.* for a few months or
>years, and watch for Frequently Asked Questions about null pointers
>or about the arguments to select().
I really wouldn't recommend comp.lang.c as a high quality source.
I recall hearing of an extensive heated discussion about the need for an
alignof keyword in C, despite the fairly obvious macro
#define alignof(type) offsetof(struct {char x; type y;}, y)
There are really better ways to waste time. Like reading the Standard.
---
Just because I was the first to vote approval of the C Standard
doesn't mean it's all my fault!
More information about the Comp.unix.programmer
mailing list