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!b7g2000pre.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Conversion from floating point to signed 16 bits Date: Wed, 20 May 2009 08:47:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <57bae2c6-b183-4a69-93ce-82a3d892b9f3@b7g2000pre.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> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1242834428 10004 127.0.0.1 (20 May 2009 15:47:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 20 May 2009 15:47:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b7g2000pre.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5963 Date: 2009-05-20T08:47:07-07:00 List-Id: 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". There is no "unsigned" integer type. However, 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). To 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. As for the complaint that the type name be confused with types in Interfaces---maybe, maybe not. It depends on who'll be reading the code. I 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. -- Adam