(char *)(-1)

R. Vuurboom roelof at idca.tds.PHILIPS.nl
Wed Aug 2 05:01:25 AEST 1989


|In article <617 at prles2.UUCP| meulenbr at cstw01.prl.philips.nl (Frans Meulenbroeks) writes:
|
|I agree that (char *) -1 could be a valid pointer.
|However the chances that it will be are so incredibly small that I for me
|would safely ignore this.
|
|Consider the following:
|If your system uses 2-s complement (most systems do) -1 would refer to
|an address with all 1-s (e.g. 0xffffffff on a 32 bit system).
|That is the very last address in the systems address space.
|So (assuming 2-s complement) (char *) -1 can only be a valid
|pointer if the following conditions are satisfied:
|- there is memory on the last address in the system
|  (not likely in the case of memory mapped I/O. Also not likely in 
|   the case of 32 bit addresses, since this requires an awful lot
|   of memory)

Well, Frans, consider the following:

I happen to have in front of me the Address Map for the support processor
on our top range computer: uses ff9xxxxx-fffxxxxx for (VME) A24 slave
access.

Our computer is already hardware ready for 1Gbyte and the memory doesn't
have to be contiguous. That means that the next generation is going to 
be 4 Gbyte.

-- 
I don't know what the question means, but the answer is yes...
KLM - Koninklijke Luchtvaart Maatschappij => coneenclicker lughtfart matscarpie
Roelof Vuurboom  SSP/V3   Philips TDS Apeldoorn, The Netherlands   +31 55 432226
domain: roelof at idca.tds.philips.nl             uucp:  ...!mcvax!philapd!roelof



More information about the Comp.std.c mailing list