From: Mark H Johnson <mark_h_johnson@raytheon.com>
Subject: Re: Signed vs Natural/32-bits vs 31 bits
Date: Mon, 25 Oct 2004 14:57:04 -0500
Date: 2004-10-25T14:57:04-05:00 [thread overview]
Message-ID: <lUcfd.9$Lq1.7@dfw-service2.ext.ray.com> (raw)
In-Reply-To: <35f054ea.0410250743.45a14771@posting.google.com>
skidmarks wrote:
> I'm using gcc under Cygwin and gcc with Mingw and am getting the
> following warning:
>
> 476. function D_Datum is new Unchecked_Conversion(Datum_Type,
> AIL_List.Datum_Type);
> |
> >>> warning: types for unchecked conversion have different sizes
> >>> warning: size of "DATUM_TYPE" is 32, size of "DATUM_TYPE" is
> 31
> >>> warning: 1 trailing bits of source will be ignored
>
> I understand what the message means but what is the operational
> effect? What does 'ignored' mean in this context?
To answer the specific question, "ignored" means "ignored". I should
really go look at my notes but if I recall, GNAT (or the newer GCC's)
doing unchecked conversion will do something like...
- ignore unused bits, value will be truncated
- source value will be extended with unspecified bits
- sign extend
- zero extend
depending on the conditions when the number of source / destination bits
do not match. These conditions basically are (in the same order...)
- destination size < source size
- destination size > source size & not a number
- destination size > source size & a signed number
- destination size > source size & an unsigned number
I generally consider a warning like this to be an error instead and fix
the offending code.
Your subject (and not the body) makes me curious, why do you need an
Unchecked_Conversion between signed and natural numbers? Is there
something wrong with doing a type cast or is there something else involved?
--Mark
next prev parent reply other threads:[~2004-10-25 19:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-25 15:43 Signed vs Natural/32-bits vs 31 bits skidmarks
2004-10-25 19:57 ` Mark H Johnson [this message]
2004-10-25 22:40 ` Jeffrey Carter
2004-10-27 15:35 ` skidmarks
2004-10-27 16:25 ` David C. Hoos
2004-10-28 7:53 ` Martin Krischik
2004-10-29 17:14 ` skidmarks
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox