Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!nbires!vianet!devine From: devine@vianet.UUCP Newsgroups: comp.lang.c Subject: Re: Standard int sizes Message-ID: <175@vianet.UUCP> Date: Thu, 16-Apr-87 19:36:55 EST Article-I.D.: vianet.175 Posted: Thu Apr 16 19:36:55 1987 Date-Received: Sat, 18-Apr-87 03:28:14 EST References: <6759@brl-adm.ARPA> <230@ems.UUCP> <170@vianet.UUCP> <835@xanth.UUCP> Organization: Western Digital, Boulder Tech Ctr Lines: 26 Keywords: int, short In article <835@xanth.UUCP>, kyle@xanth.UUCP (kyle jones) writes: > standard [...] should demand that each type be AT LEAST a certain size > Using #define's like int16 to choose the right sized int type is just too > _compiler_ dependent. Contending with machine dependencies is enough work, > without this added burden. Setting a minimal size for each integral type > still looks best to me. Since I kicked in the 'int16' posting, let's see if I can bring this to a close. I agree that the supplied types should at the minimum give a programmer some idea of the possible range it may hold. The K&R rule of short <= int <= long leaves too much up to the compiler writers (even though tradition restrains wild interpretation). So, yes, there should be consistent rules for the size of types -- both minimums and maximums. As for the 'int16' suggestion: there are cases where one needs to have exactly defined sizes. A portable program for file manipulation or network exchanges is much easier to write if a type is the same across machines. (This only leaves the *small* problems of structure packing and alignment, and byte-swapping....) My favorite for portably providing data type sizes is Pascal's ranges. But, this is 'comp.lang.c'. Bob Devine