On Monday, October 18, 1999 9:08 AM, Ohlund Magnus
[SMTP:[log in to unmask]] wrote:
> Hi,
>
> I wonder if the Rational compiler is smart enough to understand that for
> example in the following expression
>
> Tmp : Integer;
>
> Tmp := Tmp + 2**4;
>
> the compiler will understand that 2**4 is a constant ( =16 ) and replace
> the
> calculation with its value ( = 16 ).
Yes the Rational compiler is smart enough to do constant folding (and a lot
more).
But the approach of defining all such constants as a named number, giving it
some descriptive name is a good one. It is far easier to read:
One_Degree_Fahrenheit : constant := 2**4 ;
...
Tmp := Tmp + One_Degree_Fahrenheit ;
than is to read and understand why there is some particular constant in your
program.
Regards,
Steve
Steven Deller, Apex Ada Marketing
[log in to unmask], (410) 757 6924
Rational Software Corporation, http://www.rational.com
For user email groups, check http://www.rational.com/support/newsgroup