Xenix286 Wonders, Bugs, and Patches...
Chuck Forsberg WA7KGX
caf at omen.UUCP
Thu May 16 04:50:57 AEST 1985
>NULL is usually declared in stdio.h as:
> #define NULL 0
>Kernighan & Ritchie on page 98 state explicitly that, "In general, integers
>cannot meaningfully be assigned to pointers; zero is a special case." On the
>previous page they state, "C guarantees that no pointer that validly points at
>data will contain zero, ..."
>
>Thus, the code is not buggy in the least; with or without casting. If code
>such as:
> struct mumble *p;
> ...
> p = 0;
>does not assign a 32-bit wide zero on a machine with 16-bit int's and 32-bit
>pointers then you don't have a buggy program. You have a buggy compiler that
>needs fixing.
The problem is not a buggy compiler (Lord knows there are enough to go
around in PC-AT Xenix) but the difficulty of transforming a sow's ear
(8086 segmmented CPU) into a silk purse (32 bit CPU).
Pushing an int onto the stack pushes 16 bits but a large model program
is expecting to get a 32 bit magic cookie (pointer to char).
Passing zero to a function is not as universal as assigning zero to
something.
--
Chuck Forsberg WA7KGX ..!tektronix!reed!omen!caf
Omen Technology Inc 17505-V NW Sauvie IS RD Portland OR 97231
Voice: 503-621-3406 Modem: 503-621-3746 (Hit CR's for speed detect)
More information about the Comp.unix.wizards
mailing list