Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!dayton!viper!john From: john@viper.UUCP Newsgroups: comp.lang.c Subject: Re: Standard int sizes Message-ID: <832@viper.UUCP> Date: Mon, 13-Apr-87 14:34:43 EST Article-I.D.: viper.832 Posted: Mon Apr 13 14:34:43 1987 Date-Received: Wed, 15-Apr-87 03:38:14 EST References: <6759@brl-adm.ARPA> <230@ems.UUCP> <170@vianet.UUCP> <5744@brl-smoke.ARPA> Reply-To: john@viper.UUCP (John Stanley) Organization: DynaSoft Systems Lines: 39 In article <5744@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >In article <170@vianet.UUCP> devine@vianet.UUCP (Bob Devine) writes: >> ... That is, if you need a 16 bit arithmetic type, use: >> >> If "machine has compiler that uses 16 bits for 'short'" >> #define int16 short >> >> If "machine has compiler that uses 16 bits for 'int'" >> #define int16 int > >If you simply need at least 16 bits in a signed integer data type, >use "short". That way whoever reads the code doesn't have to learn >what your invention "int16" means. > Right Doug... Then I just have to "learn what your invention" short means... I've used 3 compilers where "short" == 8bit signed... I don't see any real porting problems with intXX. Any programmer who sees a header file full of lines like Bob gave who can't figure out that int16 is a sixteen bit integer doesn't belong in front of a CRT. On the other hand, ANY assumption you try making about "int, short, long, or even char" which assumes a fixed size can be proven wrong given enough compilers... I agree with Bob even though using intXX -everywhere- is, to put it mildy, a nusance. I'd probably write the program using int, char, etc and then go thru it just before I release it to change everything (except maybe char) to intXX form. On the other hand, I'd -much- prefer having to change one header file containing several intXX defines instead of having to go thru someone elses code (assumption-riddled buggy code at that) and try to figure out how big each and every type was on the originating machine by looking at the code. (I've had to do the latter and it's more of a pain than I -ever- want to have to do again...) --- John Stanley (john@viper.UUCP) Software Consultant - DynaSoft Systems UUCP: ...{amdahl,ihnp4,rutgers}!{meccts,dayton}!viper!john