From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: Ada Recursion with strings
Date: Fri, 03 Oct 2008 09:38:01 +0200
Date: 2008-10-03T09:38:01+02:00 [thread overview]
Message-ID: <s4i4cg.7ih.ln@hunter.axlog.fr> (raw)
In-Reply-To: <6e76ea5c-8bca-4c22-b561-87d2039d8924@m36g2000hse.googlegroups.com>
Maciej Sobczak a �crit :
> Buffer_Size := Get_Buffer_Size_In_Bytes;
> Buffer_Bits := Buffer_Size * 8;
>
> Is there any benefit from making the above more verbose with
> additional named constant?
> Or would it be confusing to anyone to see literal 8 (or some formula
> that is build around it) in representation clause? I don't think so.
Agreed. An even more convincing case of where you should *not* use named
constants is X**2. An abuse of the rule "don't use literals" could not
produce anything but X**Two, which is in no way better...
The rule should be: if the number has a logical meaning give it a name
(i.e. if there are 4 people in a car, call it People_In_Car, not 4). But
if it is a 2, and cannot change under any condition, by all means, call
it "2" !
(and yes, with AdaControl, you can specify exceptions to the rule that
forbids literals, like as exponent for example).
--
---------------------------------------------------------
J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
next prev parent reply other threads:[~2008-10-03 7:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 20:30 Ada Recursion with strings Joe
2008-09-30 22:24 ` Adam Beneschan
2008-09-30 22:24 ` Jeffrey R. Carter
2008-10-01 0:13 ` Joe
2008-10-01 0:27 ` Jeffrey R. Carter
2008-10-01 1:15 ` Robert A Duff
2008-10-01 11:34 ` Jeffrey R. Carter
2008-10-01 14:29 ` Adam Beneschan
2008-10-01 15:18 ` Jean-Pierre Rosen
2008-10-01 16:47 ` Georg Bauhaus
2008-10-02 7:24 ` Niklas Holsti
2008-10-02 8:18 ` Ludovic Brenta
2008-10-03 6:54 ` Maciej Sobczak
2008-10-03 7:38 ` Jean-Pierre Rosen [this message]
2008-10-03 9:06 ` Dmitry A. Kazakov
2008-10-01 0:28 ` Adam Beneschan
2008-10-01 9:48 ` Georg Bauhaus
2008-10-01 10:22 ` Dmitry A. Kazakov
2008-10-01 3:01 ` anon
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox