comp.lang.ada
 help / color / mirror / Atom feed
From: Wojtek Narczynski <wojtek@power.com.pl>
Subject: Re: Enumeration representation enhancement proposal
Date: Wed, 20 Oct 2004 10:41:46 +0200
Date: 2004-10-20T10:41:46+02:00	[thread overview]
Message-ID: <pan.2004.10.20.08.41.45.702628@power.com.pl> (raw)
In-Reply-To: rlswtxmdag9.fsf@jacob.crs4.it

Hello,

>> I don't follow, could you provide a sample Ada code which would be
>> problematic?
> 
>   for Colours use (Red => 1, Green => 2, Blue => 4, Muddy => others);
> 
>   if Muddy < Blue then
>      --  Do we ever get here?  Both 3 and 5 represents Muddy.  The one
>      --  is smaller than 4 (which represents Blue), the other one
>      --  isn't.  end if;
>   end if;

(I may be repeating myself, my previous reply somehow didn't make it to
the server...)

Clearly, representation has no impact on comparison. So we do not get
there, granted that such is the order of declaration in Ada.

The above code is not harder to compile than:

for Colours use (Red => 1, Green => 3, Blue => 2, Muddy => 4);

A, B : Colors;

if A < B then null; end if;

Here the result is also rather unrelated to the underlying rep values
order.

Also, a simple "cannonicalization" {take the least possible 'others'
value to the register (not memory)} makes the case with 'others' identical
to current situation.

Regards,
Wojtek



  reply	other threads:[~2004-10-20  8:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14  9:31 Enumeration representation enhancement proposal Wojtek Narczynski
2004-10-14 17:47 ` Nick Roberts
2004-10-15 11:06   ` Wojtek Narczynski
2004-10-19 14:55     ` Jacob Sparre Andersen
2004-10-20  8:41       ` Wojtek Narczynski [this message]
2004-10-20  8:58         ` Jacob Sparre Andersen
2004-10-20 11:04           ` Wojtek Narczynski
replies disabled

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