Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!mcsun!ukc!dcl-cs!gdt!exspes From: exspes@gdr.bath.ac.uk (P E Smee) Newsgroups: comp.lang.c Subject: Re: pointer sizes, was: Re: What does char **ch mean? Message-ID: <1991May16.132855.28564@gdr.bath.ac.uk> Date: 16 May 91 13:28:55 GMT References: <16071@smoke.brl.mil> <1991May16.102900.13063@gdr.bath.ac.uk> Reply-To: P.Smee@bristol.ac.uk (Paul Smee) Organization: University of Bristol c/o University of Bath Lines: 34 In article <1991May16.102900.13063@gdr.bath.ac.uk> P.Smee@bristol.ac.uk (Paul Smee) writes: >In article wolfram@akela.informatik.rwth-aachen.de (Wolfram Roesler) writes: >>gwyn@smoke.brl.mil (Doug Gwyn) writes: >> >>>>that the declaration char **ch; is equivalent to char *ch; >>>No, they're not at all equivalent. They might not even have the same size. >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> >>I advised somebody something similar to that, telling him (like I learned >>from the FAQ) that weird machines have weird pointers, that (char*)0 and >>0L might have different binary representations and the like. His response >>to this was: >> "I claim there are no machines like this" >>What do you gurus say about this? How about an example of a machine or OS >>where this is true? > >Don't know about current machines, but certainly on Multics (which >hasn't been dead for that long) there was absolutely no resemblance >between the null pointer (char *) 0, and any other form of 0. Apropos current machines, I just recovered my copy of 'Portable C and Unix System Programming' by J.E. Lapin (a pseudonym) of Rabbit Software Corp. (A handy book, by the way, everyone should have one. Prentice-Hall, ISBN 0-13-686494-5.) It says: On processors such as the 8086, the representation of a null pointer may differ from the arithmetic (integer sized) constant 0. On the 68000, code generation that exploits the difference between data and address registers may break code that expects the null pointer to be identical to an integer 0. -- Paul Smee, Computing Service, University of Bristol, Bristol BS8 1UD, UK P.Smee@bristol.ac.uk - ..!uunet!ukc!bsmail!p.smee - Tel +44 272 303132