TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Öhlund Magnus <[log in to unmask]>
Mon, 18 Oct 1999 15:07:56 +0200
text/plain (25 lines)

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 ).

My code looks much clearer if I use expressions like 2**4 instead of 16, but
then there is the question of execution time also. I don't want the
calculation to take place over and over again, since the function is called
quite often.

I hope I don't offend any Rational people with this question.


Magnus Íhlund

Celsius Aerotech