From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10261c,90121986704b5776 X-Google-Attributes: gid10261c,public X-Google-Thread: 109fba,4873305131bf4d94 X-Google-Attributes: gid109fba,public X-Google-Thread: fdb77,4873305131bf4d94 X-Google-Attributes: gidfdb77,public X-Google-Thread: 10c950,90121986704b5776 X-Google-Attributes: gid10c950,public X-Google-Thread: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public From: seebs@plethora.net (Peter Seebach) Subject: Re: Yet another stupid language war (was: ... the only languages you need!!) Date: 1997/11/01 Message-ID: <63ej20$mt6$3@darla.visi.com>#1/1 X-Deja-AN: 286352264 References: <34557f2b.1934172@news.mindspring.com> <345947D2.D20EF8E9@horvath.com> <63d34m$ap7$1@darla.visi.com> <345AAAF5.199FEDD3@horvath.com> X-Complaints-To: news@visi.com X-Trace: darla.visi.com 878366592 23462 205.166.146.1 (1 Nov 1997 06:43:12 GMT) Organization: Plethora Internet Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.lang.java.advocacy,comp.lang.pascal.ansi-iso,comp.lang.pascal.misc Date: 1997-11-01T00:00:00+00:00 List-Id: In article <345AAAF5.199FEDD3@horvath.com>, Bob Horvath wrote: >> Do you want storage space or range? Storage space is 'sizeof(int)', >> range is [INT_MIN, INT_MAX]. >Range. I want something that maps directly onto the problem domain. Then use Ada. :) If you can make do with "at least this much range", and the range isn't more than +/- 2^31 -1, or 0..2^32-1, C can help. >I would agree with you that Java has solved a portability problem by specifying >the size of integer types, but I think the Ada method of having types based on >ranges is a better way of doing things. I would disagree that code that >doesn't need to know the size of an int can be portable among all >implementations. The size of an int defines the range of values that will >behave predictably. Change to an implementation that changes the size of >an int, and the type definition has just changed. Right; this is why "strictly conforming" code is careful not to use values outside that range. :) >I can't think of many problem domains that require an integer to be a certain >size. Most problem domains require that a numeric value be capable of >representing a certain range of values. Well, yes, but a range like 0..2^32 -1 is going to need a 32 bit int. >A guaranteed 32 bit integer in C would be welcome (which is why >they have defined integer sizes in Java). If you assume an int is >32 bits, then it will break on a machine that defines it as 16 >bits, and if signed, might sign extend differently on a 64 bit >machine. Right. If you assume an int has the range INT_MIN..INT_MAX, you'll be fine. :) C9X offers optional exact types, and a few other enhancements... Still, it's not going to guarantee you that int32_t exists. I dunno if that's good or bad, but it's what's happening this time around. -s -- seebs@plethora.net -- Speaking for myself. No spam please. Copyright 1997. All rights reserved. This was not written by my cat. C/Unix wizard - send mail for help! -- - More Net, Less Spam!