Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!rex!ames!amdahl!dgcad!dg-rtp!webo!dg-webo!pds From: pds@lemming.webo.dg.com (Paul D. Smith) Newsgroups: comp.lang.c Subject: Re: Style guides and portability Message-ID: Date: 14 Jan 91 17:06:38 GMT References: <1163@tredysvr.Tredydev.Unisys.COM> <14824@smoke.brl.mil> <116@thor.UUCP> Sender: usenet@webo.dg.com (Usenet Administration) Distribution: comp Organization: NSDD/ONSD, Data General Corp., Westboro, MA Lines: 40 In-Reply-To: scjones@thor.UUCP's message of 13 Jan 91 17:53:07 GMT [] In article , bevan@cs.man.ac.uk (Stephen J Bevan) writes: [] > What about the cases where it is a requirement that a particular [] > int MUST be able to hold 32 bit numbers. If you transfer this to [] > a 16 bit int system, your software is going to die horribly. [] If the variable is required to hold 32 bit numbers, it should be a [] long (which is guaranteed to be large enough) rather than an int. [] I completely agree with Doug -- INT32 and friends are of no real [] value. At the risk of putting my foot in something unpleasant, I would like to say I believe INT32 & friends *are* of real value. Sure, right now "long int" is 32 bits on any machine which supports it. I firmly believe that in the relatively near future 64-bit & above machines will become a common reality. I don't know what C, etc. will do to support 64-bit integers, but I *do* know that whatever it is, I will be able to port my code with at most a simple change of the type of INT32. It helps me sleep at night ... :-) However, an even more important reason (IMHO) for the existence of INT32 et.al. is that it tells you what is expected. If you see a type INT32 in the code, you say "he wants a 32-bit integer". If you see a "long int" in the code, you say "he wants a *big* integer". In cases where it is important that the number of bits == 32, or # of bits == 16, or whatever (in networking software I find this to be a common case), a type helps the reader see what is going on. If you feel types such as "bool" are valuable as abstractions, then why not INT32? It is an abstracted name given to a quantity with particular, defined uses and properties and is distinct (IMO) from a simple "long int". paul ----- ------------------------------------------------------------------ | Paul D. Smith | pds@lemming.webo.dg.com | | Data General Corp. | | | Network Services Development Division | "Pretty Damn S..." | | Open Network Systems Development | | ------------------------------------------------------------------