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: 10a146,a03ae7f4e53958e1 X-Google-Attributes: gid10a146,public X-Google-Thread: fac41,a03ae7f4e53958e1 X-Google-Attributes: gidfac41,public X-Google-Thread: 1094ba,a03ae7f4e53958e1 X-Google-Attributes: gid1094ba,public X-Google-Thread: 103376,8775b19e3c68a5dc X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,a03ae7f4e53958e1 X-Google-Attributes: gid109fba,public X-Google-Thread: 114809,a03ae7f4e53958e1 X-Google-Attributes: gid114809,public X-Google-Thread: fa0ae,a03ae7f4e53958e1 X-Google-Attributes: gidfa0ae,public X-Google-Thread: 1014db,a03ae7f4e53958e1 X-Google-Attributes: gid1014db,public From: Joshua Waxman Subject: Re: Which language pays most? Smalltalk, not C++ nor Java. Date: 1997/12/30 Message-ID: #1/1 X-Deja-AN: 311468536 References: <199712121931.LAA25389@sirius.infonex.com> <67iipp$ktj$1@darla.visi.com> <882756127snz@genesis.demon.co.uk> <34A14C27.57C0@min.net> <67rjb3$pfb$1@brie.direct.ca> <34A50CAA.54AA@netup.cl> <685mee$5d4$1@sparcserver.lrz-muenchen.de> <34A812F9.C169A703@its.cl> X-Sender: jwaxman@acis.mc.yu.edu Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: Yeshiva University Mime-Version: 1.0 Newsgroups: comp.lang.fortran,comp.lang.c,comp.lang.c++,comp.lang.eiffel,comp.lang.java.programmer,comp.lang.smalltalk,comp.lang.perl.misc,comp.lang.ada,comp.edu Date: 1997-12-30T00:00:00+00:00 List-Id: On Tue, 30 Dec 1997, firewind wrote: > On Tue, 30 Dec 1997, Joshua Waxman wrote: > > > On Mon, 29 Dec 1997, Guillermo Schwarz wrote: > > > very poorlanguage. You can't know how many bits does an int have. Or if long > > > is actually bigger > > > than int. > > > You can't? How about sizeof(int) and if(sizeof(int) < sizeof(long)) > > sizeof(int) gives the size in bytes, which you need to multiply by > CHAR_BIT to get the number of bits. > > > > You can't ask an structure how many fields does it have. > > > > True. But structures in C++ tend to have a constant number of fields, no? > > And I'm curious as to the usefulness of this, anyway. How can you use a > structure that you don't know the layout of? Well, if you had a Stack structure, which has a variable number of fields, you can still know the basic layout of it and thus use it, but it would be useful to know how many stack elements there are. C++, of course, might do this with a structure containing a linked list of constant sized elements, and in this case the size is known or can easily be determined. > > > > In C++ there is no way to handle overflow of integers. > > > > Check after each addition to see if you reversed signs, and act > > accordingly. > > What about unsigned arirthmetic? What if sign reversal is possible (but > not garunteed) in this expression, without any overflow? > He said integers, and int without any modifier is signed. I was talking in terms of addition, and when you add or multiply by positive numbers, I would expect the only way to change sign is with overflow. If a newgative number you are adding, sign change is possible, but then we wouldn't worry about overflow. Anyway, probably the best way to handle this is to make classes Integer, and UnsignedInteger, overload operators, and let the internals worry about checking for overflow conditions. By the way, it is spelled *guaranteed*. Josh Waxman > [- firewind -] > [- email: firewind@metroid.dyn.ml.org (home), firewind@aurdev.com (work) -] > [- "You're just jealous because the voices talk to -me-." -] > [- Have a good day, and enjoy your C. -] > [- (on a crusade of grumpiness where grumpiness is due) -] > > >