From: clubley@remove_me.eisner.decus.org-Earth.UFP
On 2025-11-17, Arne Vajhøj wrote:
> Ada is generally pretty good.
>
> But I don't know if you noticed that the example gave a
> warning.
>
I noticed the warning, but I let it slide because I didn't want to
start _yet_ another argument about compiler flags and warnings, plus
the fact I have several other discussions going on at the moment. :-)
> The warning did not have an impact.
>
> But the same warning in another context can indicate
> huge problem.
>
> And I was surprised.
>
Interesting, but I've never encountered this because I never allow
compiler warnings to stand. They _always_ get fixed regardless of
language, even for own-time personal projects. In this case, I would
have noted the difference in sizes, gone "Simon, you silly twit!"
and fixed up the sizes. (It's only supposed to used in conversions
of the same size).
BTW, compilers which support it, regardless of language, always get
used by me in a mode which converts warnings to fatal errors.
The GNAT RM has more information:
https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/stand
rd_library_routines.html
Search for "Ada.Unchecked_Conversion (13.9)". It also tells you what happens,
at least in the case of GNAT, if you do try to use different sizes.
Once you read that, you will see where the value "1" is coming from.
Simon.
--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.
--- SoupGate-Win32 v1.05
* Origin: you cannot sedate... all the things you hate (1:229/2)
|