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,8af7fe40dc0a55ae X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!r10g2000prf.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Restarting Tread: Why isn't this program working with Unchecked_Converstion Date: Fri, 16 Jan 2009 00:02:17 -0800 (PST) Organization: http://groups.google.com Message-ID: <4adc513b-22b1-40ff-a75a-50c14d9873ac@r10g2000prf.googlegroups.com> References: 40239b21-b265-467f-9b27-5890fb2f4c67@w1g2000prm.googlegroups.com <6540d68e-2cc7-45aa-a5d2-ac16fa335822@i24g2000prf.googlegroups.com> NNTP-Posting-Host: 81.156.241.243 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1232092937 16629 127.0.0.1 (16 Jan 2009 08:02:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 16 Jan 2009 08:02:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r10g2000prf.googlegroups.com; posting-host=81.156.241.243; 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.5) Gecko/2008120121 Firefox/3.0.5,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:4342 Date: 2009-01-16T00:02:17-08:00 List-Id: On Jan 15, 11:20=A0pm, ChristopherL wrote: > On Jan 15, 5:24=A0pm, Martin wrote: > > > And that's assuming the Unchecked_Conversion works - double > > check the actual sizes! > > In the debugger when I look at Float'Size it tells me 32. > When I look at Short_integer1'Size it tells me 10, and for > Short_integer2'Size it tell me 10. Ok, according the Bob Duff's explanation, that can happen. BUT hopefully you can now see that this is NOT PORTABLE and that you shouldn't rely on it - the next time you upgrade you compile (or change it completely), this may not be the case. Go and try the "GNAT GPL 2008" compiler on Windows from the ("GNAT Libre" site) and you'll see this. This is why using subtypes of Integer/Natural (their sizes are not always the same - just like C!!) are avoided and why you need to use your own types - see (lots of) other posts - if you want to be sure of sizes. This is the "Ada way". Don't fight it, it's easier but will require you to stop thinking in C. Cheers -- Martin