Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: What breaks? (was Re: 64 bit longs?)
Message-ID: <1991Jan15.053356.2631@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <2567@casbah.acns.nwu.edu> <1991Jan13.220958.16568@zoo.toronto.edu> <54379@eerie.acsu.Buffalo.EDU>
Date: Tue, 15 Jan 1991 05:33:56 GMT

In article <54379@eerie.acsu.Buffalo.EDU> chu@acsu.buffalo.edu (john c chu) writes:
>>It is intuitively appealing, but I would be surprised to see anyone
>>implementing it:  it would break far too much badly-written software.
>
>Can someone please tell me what would break under that model and why?

There is an awful lot of crufty, amateurish code -- notably the Berkeley
kernel networking stuff, but it's not alone -- which has truly pervasive
assumptions that int, long, and pointers are all the same size:  32 bits.

At least one manufacturer of 64-bit machines has 32-bit longs and 64-bit
long longs for exactly this reason.

The problem can largely be avoided if you define symbolic names for your
important types (say, for example, net32_t for a 32-bit number in a TCP/IP
header) and consistently use those types, with care taken when converting
between them, moving them in and out from external storage, and passing
them as parameters.  This is a nuisance.  It's a lot easier to just treat
all your major types as interchangeable, but God will get you for it.
-- 
If the Space Shuttle was the answer,   | Henry Spencer at U of Toronto Zoology
what was the question?                 |  henry@zoo.toronto.edu   utzoo!henry
