comp.lang.ada
 help / color / mirror / Atom feed
From: Martin <martin.dowie@btopenworld.com>
Subject: Re: Restarting Tread: Why isn't this program working with Unchecked_Converstion
Date: Fri, 16 Jan 2009 00:02:17 -0800 (PST)
Date: 2009-01-16T00:02:17-08:00	[thread overview]
Message-ID: <4adc513b-22b1-40ff-a75a-50c14d9873ac@r10g2000prf.googlegroups.com> (raw)
In-Reply-To: a8ef6226-db87-4c4c-b38e-9dbc77374f4c@t11g2000yqg.googlegroups.com

On Jan 15, 11:20 pm, ChristopherL <clusard...@aol.com> wrote:
> On Jan 15, 5:24 pm, Martin <martin.do...@btopenworld.com> 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



  parent reply	other threads:[~2009-01-16  8:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15 21:24 Restarting Tread: Why isn't this program working with Unchecked_Converstion Martin
     [not found] ` <a8ef6226-db87-4c4c-b38e-9dbc77374f4c@t11g2000yqg.googlegroups.com>
2009-01-16  0:45   ` tmoran
2009-01-16  8:02   ` Martin [this message]
     [not found] <83d19cd8-71ca-43c1-a3eb-05832290e565@r36g2000prf.googlegroups.com>
2009-01-15 21:22 ` Jeffrey R. Carter
     [not found]   ` <37daf0e6-39b8-4820-a7fc-b6c5decf1ed8@q19g2000yqi.googlegroups.com>
2009-01-16  0:22     ` Jeffrey R. Carter
     [not found] ` <40239b21-b265-467f-9b27-5890fb2f4c67@w1g2000prm.googlegroups.com>
2009-01-16  2:27   ` Adam Beneschan
     [not found]     ` <9069fcf7-4257-4439-ad4a-8d7c8c17f5cf@v5g2000pre.googlegroups.com>
2009-01-16 15:11       ` Ludovic Brenta
2009-01-16 16:23         ` Martin
     [not found]         ` <70172b19-360c-4eba-815c-ede747c3bcdf@w39g2000prb.googlegroups.com>
2009-01-16 17:24           ` Ludovic Brenta
2009-01-16 17:26           ` Martin
2009-01-16 17:34           ` Georg Bauhaus
2009-01-16 12:18 ` Stuart
2009-01-16 23:14   ` sjw
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox