Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!randvax!segue!jim From: jim@segue.segue.com (Jim Balter) Newsgroups: comp.unix.programmer Subject: Re: Nice() in Sys V.4 Message-ID: <6905@segue.segue.com> Date: 28 Mar 91 11:31:06 GMT References: <318@secola.Columbia.NCR.COM> <1991Mar21.141753.28726@nncrcae.Columbia.NCR.COM> <11393@dog.ee.lbl.gov> <11478@dog.ee.lbl.gov> Reply-To: jim@segue.segue.com (Jim Balter) Organization: Segue Software, Inc. - Santa Monica, CA. +1-213-453-2161 Lines: 46 In article <11478@dog.ee.lbl.gov> torek@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!