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,fa37ee962bc4b00d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!n21g2000vba.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Conversion from floating point to signed 16 bits Date: Wed, 20 May 2009 09:13:38 -0700 (PDT) Organization: http://groups.google.com Message-ID: <03e3ae12-0691-4b16-8b55-23cace959cc0@n21g2000vba.googlegroups.com> References: <4a12ffa3$0$2853$ba620e4c@news.skynet.be> <4a13e54a$0$32672$9b4e6d93@newsspool2.arcor-online.net> <14718292-2ea8-4c22-8cf6-47671490976d@b1g2000vbc.googlegroups.com> <57bae2c6-b183-4a69-93ce-82a3d892b9f3@b7g2000pre.googlegroups.com> NNTP-Posting-Host: 86.163.75.222 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1242836018 6331 127.0.0.1 (20 May 2009 16:13:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 20 May 2009 16:13:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n21g2000vba.googlegroups.com; posting-host=86.163.75.222; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5964 Date: 2009-05-20T09:13:38-07:00 List-Id: On May 20, 4:47=A0pm, Adam Beneschan wrote: > On May 20, 8:23=A0am, Martin wrote: > > > > > On May 20, 4:18=A0pm, "Jeffrey R. Carter" > > > wrote: > > > Martin wrote: > > > > > Or better - just use package Interfaces instead... > > > > No. Interfaces.Unsigned_16 is a modular type. The OP's Unsigned_16 is= a signed > > > integer type. > > > > -- > > > Jeff Carter > > > "English bed-wetting types." > > > Monty Python & the Holy Grail > > > 15 > > > So it is!! > > > A rather poorly named type then...tricky to think of a better name > > though - perhaps the Interfaces names should have been Modular_16 / > > etc. Too late now...back to Int16 and Uint16 it is then... > > As Jeff said, the OP's Unsigned_16 is a "signed integer type" > according to the definitions in the Ada standard, which defines two > kinds of integer types, "signed" and "modular". =A0There is no > "unsigned" integer type. =A0However, a type like Unsigned_16 will > usually be implemented (on an 8-bit-byte-addressable machine) as a 16- > bit unsigned integer (objects of the type will occupy exactly two > bytes, and the code will use instructions that operate on 16-bit > unsigned integers where possible, if such instructions exist). =A0To me, > that makes it hard to criticize the choice of name---practically > speaking, it's an unsigned 16-bit integer type in normal industry > parlance, and we can't expect Ada programmers to know the details of > the standard's terminology as well as we language lawyers do. =A0As for > the complaint that the type name be confused with types in > Interfaces---maybe, maybe not. =A0It depends on who'll be reading the > code. =A0I don't think we can decree that every name defined by the > Standard is off-limits for programming use, so we have to draw a line > somewhere. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0--= Adam Yes, the names in Interfaces do match those used by the C-style of languages but it's a shame that because those other languages don't have the rich variety that Ada does that we end up with a bit of a mismatch. I'm so used to Unsigned_16/etc being modular that whenever I see them that's what I expect. Cheers -- Martin