comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada code snippet help (array of arrays)
Date: Thu, 14 May 2009 19:14:18 +0200
Date: 2009-05-14T19:14:22+02:00	[thread overview]
Message-ID: <100oa8l17auxl.1o05hrb8j459.dlg@40tude.net> (raw)
In-Reply-To: 491646c2-ec53-4f54-9e6e-f89d59f40b76@d38g2000prn.googlegroups.com

On Thu, 14 May 2009 08:16:22 -0700 (PDT), Adam Beneschan wrote:

> On May 14, 1:05 am, Egil H�vik <egilho...@hotmail.com> wrote:
> 
>>>    T: constant Boolean := True;
>>>    F: constant Boolean := False;
>>
>> No need to define your own constants... True and False are
>> already enumerated values (constants) of type Boolean.
> 
> I think he defined those just for readability.  If you have a large
> constant array, it might look better, look more like a chart, take up
> less space on the screen, be easier to line up, etc., if you can do it
> with shorter names such as single letters.  I've seen this sort of
> thing done before.

Well, in this case I have a better proposal:

   X : constant Boolean_Array (1..100) :=
          (  1..10 | 13..15 | 45 | 77 => True, others => False);

In fact, need to specify enumeration literals no more than just once!

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



      reply	other threads:[~2009-05-14 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 14:11 Ada code snippet help (array of arrays) Vamp4L
2009-05-13 14:25 ` Georg Bauhaus
2009-05-13 14:28   ` Vamp4L
2009-05-13 15:05 ` Jacob Sparre Andersen
2009-05-14  8:05 ` Egil Høvik
2009-05-14 15:16   ` Adam Beneschan
2009-05-14 17:14     ` Dmitry A. Kazakov [this message]
replies disabled

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