Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!apple!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.unix.programmer Subject: null pointers (was: Nice() in Sys V.4) Message-ID: <1991Apr1.051215.21466@athena.mit.edu> Date: 1 Apr 91 05:12:15 GMT References: <11478@dog.ee.lbl.gov> <6905@segue.segue.com> Sender: news@athena.mit.edu (News system) Reply-To: scs@adam.mit.edu Organization: Thermal Technologies, Cambridge, MA Lines: 39 In article <6905@segue.segue.com> jim@segue.segue.com (Jim Balter) writes: >...but note that many many programs use memset or calloc >to clear arrays or structures that contain pointers. > >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}; > >I really wouldn't recommend comp.lang.c as a high quality source. I can't claim that comp.lang.c has a stellar signal/noise ratio, but, as Usenet groups go, it is generally more reliable for C-specific information than other groups. Regular readers of comp.lang.c know that: there are good reasons for an architecture's choosing to use a nonzero internal value for null pointers; it is invalid to use calloc or memset to fully initialize aggregates containing pointers (if it is desired to initialize the pointers to null pointers); and systems which use nonzero internal values for null pointers may not use zero-initialized segments (comparable to Unix' bss) for statically-allocated pointer data, but must emit explicitly initialized data segments. All of these issues are discussed in the comp.lang.c Frequently Asked Questions list. Steve Summit scs@adam.mit.edu