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: 103376,ab1d177a5a26577d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!195.71.90.67.MISMATCH!news.unit0.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: What's wrong with C++? Date: Thu, 17 Feb 2011 20:55:18 +0100 Organization: A noiseless patient Spider Message-ID: <87vd0izba1.fsf@ludovic-brenta.org> References: <1ee1a434-4048-48f6-9f5e-d8126bebb808@r19g2000prm.googlegroups.com> <4D5C1824.3020509@obry.net> <21443638-5ec6-49d4-aafe-6fbc1e59daba@r19g2000prm.googlegroups.com> <87d2371e-af91-4d6a-8d5b-3ddb972d84fd@k17g2000pre.googlegroups.com> <87zkpuze5e.fsf@ludovic-brenta.org> <4d5d791f$0$17330$882e7ee2@usenet-news.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="XVLOQe0bk3AY7hjNxi1+9g"; logging-data="29937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nu/bDj1mDHj58cOKHJwjY" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:I3kYW5xhEDj+1zZQhIK3qfzVyLA= sha1:6PUm9IvpK0PJ1OL2ZFcw6y/oNzU= Xref: g2news1.google.com comp.lang.ada:17360 Date: 2011-02-17T20:55:18+01:00 List-Id: Hyman Rosen writes: > On 2/17/2011 1:53 PM, Ludovic Brenta wrote: >> No, it only means that enumerations in C++ really are integers >> and not enumerations. > > This was a choice made by the people who incorporated enumerations > into C. They felt it important that enumerations should be usable > in the style of bitmasks. And what does it mean for something to be > "really an integer"? Simple: integers have arithmetic, enumeration values don't. > Ada 'Pos and 'Val attributes certainly give the illusion that Ada > enumerators are integers too! If you mean to say that Ada provides features for unsafe programming, then if course we all knew that. Ada also has overlays and machine code insertions that allow the programmer to do anything they please. Now try this and see your "illusion" shattered by reality: type E is (A, B, C); B : E := E'Val (E'Pos (A) + E'Pos (C)); -- Constraint_Error In this respect like in many others, Ada is safe by default and unsafe if the programmer really wants that. -- Ludovic Brenta.