Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!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.102900.13063@gdr.bath.ac.uk> Date: 16 May 91 10:29:00 GMT References: <1991May4.062007.3264@weyrich.UUCP> <16071@smoke.brl.mil> Reply-To: P.Smee@bristol.ac.uk (Paul Smee) Organization: University of Bristol c/o University of Bath Lines: 32 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. Pretending there was could get you into trouble. Further, there's no reason to believe that (char *) 0 and 0L will be the same on all future machines. The standard doesn't require it. All the standard requires is that if you cast 0 to a pointer (something *) 0, the conversion will result in whatever bit pattern that machine/OS uses as null pointers. There are absolutely NO guarantees about what that will look like internally -- if your code cares, then it is NOT portable, and it WILL come back to haunt you (or your replacement) someday. -- 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