Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!spool.mu.edu!mips!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.lang.c Subject: Re: 64 bit architectures and C/C++ Message-ID: <1991May10.204625.26251@ux1.cso.uiuc.edu> Date: 10 May 91 20:46:25 GMT References: <16023@smoke.brl.mil> <1991May2.033545.15051@athena.mit.edu> <16036@smoke.brl.mil> <1991May6.232116.11401@sq.sq.com> <1991May9.192156.19291@nightowl.MN.ORG> Organization: University of Illinois at Urbana Lines: 39 det@nightowl.MN.ORG (Derek E. Terveer) writes: >What is wrong with simply implementing the following in a compiler? > char = 8 bits > short = 16 bits > int = 32 bits > long = 64 bits There is apparently (as some people complain about) code out there that depends upon the MAX size of the type. In other words, if "long" is longer than 32 bits, it breaks. But porting such code to a 64-bit machine *AND* writing good standardized code for the same machine are in mutual conflict because of this. The only way out I can see is for the compiler to default to what is the most reasonable for NEW AND GOOD code to be developed, and have some sort of flag or flags to allow it to be customized to better handle the cases of porting old code. I'd also suspect that if you can find code where the long depends on being exactly 32 bits, you could well find code where the int depends on being exactly 16 bits. So there probably is not one single ideal solution to the problem. So perhaps a system of flags like: -SHORTnn -INTnn -LONGnn Which actually change the sizes of the primitive types, giving a warning if the "short <= int <= long" constraint is violated (but do the compile as specified anyway). It would be an extension, not standard C. But when porting old code, we aren't addressing standards, are we? -- /***************************************************************************\ / Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \ \ Lietuva laisva -- Brivu Latviju -- Eesti vabaks | people; CRIMINALS do!! / \***************************************************************************/