Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!bu.edu!m2c!jjmhome!smds!rh From: rh@smds.UUCP (Richard Harter) Newsgroups: comp.lang.c Subject: Re: pointer sizes, was: Re: What does char **ch mean? Summary: Fun with Prime Message-ID: <466@smds.UUCP> Date: 16 May 91 06:33:51 GMT References: <1991May4.062007.3264@weyrich.UUCP> <16071@smoke.brl.mil> Organization: SMDS Inc., Concord, MA Lines: 33 In article , wolfram@akela.informatik.rwth-aachen.de (Wolfram Roesler) 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? Prime machines (their native line, not the UNIX boxes they are reselling) are good exercises for the sloppy at heart. Prior to PRIMOS 19.4, some pointers were 32 bits and some were 48 bits. If memory serves me correctly (int *) was 32, (char *) was 48. At some point they changed it so that all pointers were 48 bits. Also (char *)0 was definitely not 0L; the extra 16 bits hold information -- segment number or ring number or some such. As a general rule, machines with segment architecture do funny things with pointers that enforce your respect for language rules. My observation is that funny architectures and such don't matter as long as your code in lint clean -- you never see the problems because you follow the rules that avoid the problems. However these fussy rules are only for portability freaks. If your friend is only going to have one job in his life, work on only one machine in his life, and only use one compiler I see no reason why he should worry about these issues. -- Richard Harter, Software Maintenance and Development Systems, Inc. Net address: jjmhome!smds!rh Phone: 508-369-7398 US Mail: SMDS Inc., PO Box 555, Concord MA 01742 This sentence no verb. This sentence short. This signature done.