mccrady@torolab6.vnet.ibm.com ("++Don;") (05/16/91)
> 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? Example: The IBM AS/400... (char *)0 is 16 bytes long, and not just 16 bytes of zero. 0L is ordinary 2's complement integer, with 4 bytes of zero. ++Don;
burley@mole.gnu.ai.mit.edu (Craig Burley) (05/16/91)
Another machine where NULL and 0 have different representations: The Prime 50 Series. Assuming they implemented C NULL pointers the way all the other languages did, NULL in C, which is "(char *) 0" or "(void *) 0", actually has a pointer value of 07777/0, where the first number is the (octal) segment number and the second is the word offset within the segment. It is possible that one or more C implementations under PRIMOS used 0/0 as NULL instead of 07777/0, but that'd probably be only to deal with old C code that assumed that on all machines a NULL pointer had the same binary representation as integer 0. I'd be very surprised if the "official" or standard way to compile C code under PRIMOS wasn't to use the 07777/0 representation for NULL, since other languages (PL/I for example) use that representation, as do libraries and OS system calls. -- James Craig Burley, Software Craftsperson burley@gnu.ai.mit.edu