comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GNAT Optimization of Constant Expressions
Date: Fri, 18 May 2007 09:58:33 +0200
Date: 2007-05-18T09:58:07+02:00	[thread overview]
Message-ID: <nate4ff5zvbm$.kztgxktx4lbq$.dlg@40tude.net> (raw)
In-Reply-To: f2iou1$ks5$1@jacob-sparre.dk

On Thu, 17 May 2007 18:38:34 -0500, Randy Brukardt wrote:

[...]
> And the use of constants as arguments to those expensive
> routines is pretty silly. (Besides, good Ada practice would be to name your
> constants, and when you did that, you got essentially the same code as with
> Fortran.)

I think that it not a good idea to rely on good practice. There is a
language problem of specifying that the calls to a function with static
constant shall yield static result. This is not just sin (Pi/3.0), but also

   for ... loop
      if Match (Text, <pattern-expression>) then

or

   Create_Combo_Box ("ada" + "c" +  "c++" + ...);

or

   5.0 * m + 10.0 * feet

Folding self-descriptive expressions into constants declared miles away
from their only use is not a good style.

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



  reply	other threads:[~2007-05-18  7:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16 22:37 GNAT Optimization of Constant Expressions David Smith
2007-05-17  4:50 ` Randy Brukardt
2007-05-17 20:03   ` Gautier
2007-05-17 20:46     ` Randy Brukardt
2007-05-17 22:49       ` David Smith
2007-05-17 23:38         ` Randy Brukardt
2007-05-18  7:58           ` Dmitry A. Kazakov [this message]
2007-05-18 11:27           ` Georg Bauhaus
2007-05-18 17:28             ` Randy Brukardt
2007-05-18 16:25       ` Ray Blaak
2007-05-18 17:40         ` Randy Brukardt
2007-05-18 22:51           ` Adam Beneschan
2007-05-19  2:44             ` Randy Brukardt
2007-05-18  9:05   ` Markus E Leypold
2007-05-18  9:47   ` Florian Weimer
2007-05-18 11:32     ` Duncan Sands
2007-05-18 17:20     ` Randy Brukardt
2007-05-18 17:35       ` Duncan Sands
     [not found]       ` <200705181935.23877.baldrick@free.fr>
2007-05-18 17:49         ` Duncan Sands
2007-05-17  5:30 ` Martin Krischik
2007-05-18  9:56 ` Duncan Sands
2007-05-18 15:39   ` David Smith
2007-05-18 17:08     ` Duncan Sands
     [not found]     ` <200705181908.54920.baldrick@free.fr>
2007-05-18 17:32       ` Duncan Sands
replies disabled

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