sizeof, ptrs, lint, portability

Kevin Martin kpmartin at watmath.UUCP
Sun Feb 10 07:47:46 AEST 1985


In article <8121 at brl-tgr.ARPA> cottrell at nbs-vms.ARPA writes:
>-) I apologize for calling (presumably someone's favorite) machines `weird'
>   or `braindamaged'. Let's say `less capable'.
Let's say 'capable of doing things other than you want done'.
I doubt that a pianist would like being called 'weird', 'braindamaged',
or even 'less capable' just because you happen to want to hear her play a
trombone.

>   Allowing any other value to actually be stored breaks this. Besides,
>   SHOW ME A C THAT USES ANYTHING OTHER THAN ZERO ON ANY MACHINE!!!
>   K&R says of pointer to integer conversions: "The mapping funxion is
>   also machine dependent, but is intended to be unsurprising to those
>   who know the machine." I would be surprised at nonzero null ptrs.
Then you obviously don't know the machine.
A Honeywell DPS8, running CP-6, uses the bit pattern 06014 (36 bits)
as the null pointer (byte offset zero in segment number 014).
The pointer to int casts (and back) are accomplished by ex-oring
with this value.
The value 0 CAN'T be used, since this is a valid pointer.

>-) How many of you port what percentage of programs? I thought the
>   intent of the standard was to not break existing programs.
I don't think it does break programs (except those which use =<op>
and initializers without the '='). Your programs will continue
to run on systems on which they previously ran. You may get
more warnings when you compile them, though.

                     Kevin Martin, UofW Software Development Group



More information about the Comp.lang.c mailing list