Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: What breaks? (was Re: 64 bit longs?) Message-ID: <14896@smoke.brl.mil> Date: 18 Jan 91 21:24:56 GMT References: <1991Jan15.202123.14223@gjetor.geac.COM> <14890@smoke.brl.mil> <1991Jan18.044948.27943@zoo.toronto.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 31 In article <1991Jan18.044948.27943@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >In article <14890@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: >>There is no portable way to declare any integral type constrained to use >>precisely 32 bits in its representation. However, "long" portably declares >>one that has AT LEAST 32 bits in its representation (or, you could express >>this in terms of the guaranteed range of representable values). net32_t >>is hopeless for the first case and unnecessary for the second. >Uh, Doug, please don't confuse the two slightly different threads of >discussion here. But the discussion has bifurcated, and I was responding specifically to that (which is why there are two distinct cases considered in my posting). >There is no portable way to declare a type with *exactly* 32 bits, ... And there is no guarantee that such a type even exists, which is why I disagree to some extent with ... >Life with 64-bit longs would be a whole lot easier if the authors of >certain kernel networking software -- for example -- had consistently >used a net32_t typedef rather than int and long. Life would only be easier for systems whose C implementations provided an integral type of exactly 32 bits. On the other hand, if the code had been designed to work anywhere that AT LEAST 32 bits were supported, it would have made life even easier. To do the latter it would have sufficed to use (unsigned) long. The main advantage of a typedef would simply be for purposes of encapsulating an abstract data type (netaddr_t, for example). While that is important, I want to be sure that nobody mistakenly believes that it legitimizes building in assumptions about EXACT sizes for integral representations.