This is the mail archive of the
mailing list for the GCC project.
Re: Ada subtypes and base types
- From: Jeffrey A Law <law at redhat dot com>
- To: Waldek Hebisch <hebisch at math dot uni dot wroc dot pl>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 13 Mar 2006 15:31:10 -0700
- Subject: Re: Ada subtypes and base types
- References: <E1FDnj3firstname.lastname@example.org>
- Reply-to: law at redhat dot com
On Mon, 2006-02-27 at 20:08 +0100, Waldek Hebisch wrote:
> What do you mean by "abuse"? TYPE_MAX_VALUE means maximal value
> allowed by given type.
As long as you're *absolutely* clear that a variable with a
restricted range can never hold a value outside that the
restricted range in a conforming program, then I'll back off
the "abuse" label and merely call it pointless :-)
The scheme you're using "promoting" to a base type before all
arithmetic creates lots of useless type conversions and means
that the optimizers can't utilize TYPE_MIN_VALUE/TYPE_MAX_VALUE
anyway. ie, you don't gain anything over keeping that knowledge
in the front-end.