Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!bu-cs!bzs From: bzs@bu-cs.BU.EDU (Barry Shein) Newsgroups: comp.lang.c Subject: Re: Standard int sizes Message-ID: <6451@bu-cs.BU.EDU> Date: Sun, 12-Apr-87 22:56:11 EST Article-I.D.: bu-cs.6451 Posted: Sun Apr 12 22:56:11 1987 Date-Received: Sat, 18-Apr-87 17:37:28 EST References: <6759@brl-adm.ARPA> <230@ems.UUCP> <567@csun.UUCP> <103@asi.UUCP> Organization: Boston U. Comp. Sci. Lines: 36 In-reply-to: metro@asi.UUCP's message of 12 Apr 87 17:07:05 GMT Posting-Front-End: GNU Emacs 18.41.4 of Mon Mar 23 1987 on bu-cs (berkeley-unix) From: metro@asi.UUCP (Metro T. Sauper) >Wouldn't it be interesting to be able to specify the size of an integer >variable. Perhaps a method like the one used in IBM's fortran 66 compiler. >It was actually an IBM extension to the language i believe. > > int*4 value1; /* 4 byte integer */ > int*2 value2; /* 2 byte integer */ > int*1 value3; /* 1 byte integer */ Hey, why not go whole hog (pun intended) and go for the PL/I solution? declare foo fixed bin(31); declare goo fixed bin(15); declare moo packed decimal (17,3); The numbers are BITs, can't get finer tuned control than that on most systems! The problem with your suggestion is that it only works if the machine you use has a reasonable notion of a byte (that is, *4 WHATs?) A Byte is not standardized and it's not at all obvious that an integral number of them fit in a word (the PDP-10 would need int*4.5, the S1 uses 9-bit bytes as I remember.) The problem with my solution is that it leads to software anarchy. The purpose of compilers is not necessarily to provide as many choices as possible. That's the purpose of marketing departments. Better to try to provide some clean leadership rather than a zillion choices. No, the issue is how to come up with abstracted constructs that can be mapped reasonably portably to a lot, if not all, architectures. Not more rope to shoot yourself in the foot with (?!) -Barry Shein, Boston University