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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,b92b95c9b5585075 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!feeder.news-service.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.c++,comp.lang.ada Subject: Re: Why use C++? Date: Fri, 12 Aug 2011 23:22:05 +0200 Organization: A noiseless patient Spider Message-ID: <8739h65nr6.fsf@ludovic-brenta.org> References: <1e292299-2cbe-4443-86f3-b19b8af50fff@c29g2000yqd.googlegroups.com> <1fd0cc9b-859d-428e-b68a-11e34de84225@gz10g2000vbb.googlegroups.com> <9ag33sFmuaU1@mid.individual.net> <1d8wyhvpcmpkd.ggiui9vebmtl.dlg@40tude.net> <150vz10ihvb5a.1lysmewa1muz4$.dlg@40tude.net> <1q4c610mmuxn7$.1k6s78wa0r8fj.dlg@40tude.net> <4e44e50a$0$7619$9b4e6d93@newsspool1.arcor-online.net> <4e4560e7$0$6546$9b4e6d93@newsspool4.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="mZ8tQcAeMZgZd5Kg37D9kg"; logging-data="10506"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+imKPsjq3ooWnnSSBAX5wa" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:XJxrKwj+mXHsTH390BvTKFaMSUQ= sha1:bP92SEygbjsmdw/e1y0oMVf68Os= Xref: g2news1.google.com comp.lang.c++:82896 comp.lang.ada:20584 Date: 2011-08-12T23:22:05+02:00 List-Id: Jed writes: >> When have you last thought about the size of the components >> of std::string, of of a vtable? Why, then, is there a >> pressing need to think about the sizes of int types? > > You know that that was a very bad comparison. Completely invalid. On the contrary I think this comparison is perfectly valid. The language should distinguish between integers (i.e. numbers) and various kinds of machine registers. If you think you need to know the number of bits in an int, this indicates you are dealing with low-level stuff and therefore need something much more precise than "int", which specifies not only size in bits but also bit-endianness, byte-endianness, alignment, permissible operations and, if arithmetic is possible at all, overflow semantics. C conveniently ignores all these things and leaves them unspecified. With Ada, the programmer can specify most of those aspects (except, sadly, for byte-endianness). If you confuse "size of an int" for "range of permissible values for an int", then you ignore the possibility that the range might not fit at all with any size in bits, e.g. subtype Fridge_Temperature is range 250 .. 313; -- kelvins Most of the time, you do *not* need to know the size of an int; instead you need to know the size of a hardware register, field in a network protocol, etc and these are, quite often, *not* numbers. -- Ludovic Brenta. The Chief Legal Officer proactively enables our potentials.