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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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 Path: g2news1.google.com!postnews.google.com!o30g2000pra.googlegroups.com!not-for-mail From: Edward Fish Newsgroups: comp.lang.ada Subject: Re: What's wrong with C++? Date: Fri, 18 Feb 2011 14:00:51 -0800 (PST) Organization: http://groups.google.com Message-ID: <0b26ed80-efa2-46ac-b7bb-049d47d5acf7@o30g2000pra.googlegroups.com> 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> <4d5da93f$0$17330$882e7ee2@usenet-news.net> <4d5daeea$0$17330$882e7ee2@usenet-news.net> <1c9e385a-b3f8-4221-9082-029e389c6ba4@r4g2000prm.googlegroups.com> <4d5ed0c4$0$2975$882e7ee2@usenet-news.net> <4d5ed63d$0$2975$882e7ee2@usenet-news.net> NNTP-Posting-Host: 174.28.187.177 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1298066451 9498 127.0.0.1 (18 Feb 2011 22:00:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 18 Feb 2011 22:00:51 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o30g2000pra.googlegroups.com; posting-host=174.28.187.177; posting-account=IGEw6QoAAAChe8btAoGmJk0kqF3q3VLA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:17437 Date: 2011-02-18T14:00:51-08:00 List-Id: On Feb 18, 12:27=A0pm, Hyman Rosen wrote: > On 2/18/2011 3:10 PM, Edward Fish wrote: > > > But there's nothing that says bit pattern 0010 is Decimal 2. > > If you want to associate your literals with bit patterns, > you could do, similar to the 83 Rationale suggestion > : > (I don't know Ada, so pardon if this isn't quite right). > > =A0 =A0 =A0PermissionsPatterns: constant array(Permissions) of Integer := =3D > =A0 =A0 =A0 =A0 =A0(Read =3D> 2#0001#, Write =3D> 2#0010#); > > But when you go around telling the compiler that it should > actually represent Read as 2#0001# and Write as 2#0010#, > you're not going to convince me that this isn't treating > enumerations as if they are integers. What's wrong with that? If the bits are, for example, directly tied to hardware trace-lines then 2#0010# is sending a voltage (or lack thereof, if one is using a platform where '0' is represented by a voltage and '1' by a lack thereof) then there isn't any correlation between that bit-pattern and an integer. Another way to represent this idea would be something like: CONTROLLER_ADDRESS : Constant Address:=3D [wherever the address happens to be]; Type Commands is record Read, Write, Reset, Lock : Boolean; end record; For Commands use record Read At 0 Range 0..0, Write At 0 Range 1..1, Reset At 0 Range 2..2, Lock At 0 Range 3..3 end record; Controller : Commands; Fore Controller'Address Use CONTROLLER_ADDRESS; Is *THAT* an integer? At all? > > Hey, can I do this? If not, why? > > =A0 =A0 =A0Type Constants is ( Pi, E, Phi ); > =A0 =A0 =A0For Constants use record > =A0 =A0 =A0 =A0 =A0Pi =A0=3D> 3.141592654, > =A0 =A0 =A0 =A0 =A0E =A0 =3D> 2.718281828, > =A0 =A0 =A0 =A0 =A0Phi =3D> 1.618033989 > =A0 =A0 =A0end record; Sure you *could* do that... but why?