comp.lang.ada
 help / color / mirror / Atom feed
* GNAT 4.4.5 order of conditional processing?
@ 2011-11-15 20:30 awdorrin
  2011-11-15 20:54 ` Niklas Holsti
  2011-11-15 23:08 ` Jeffrey Carter
  0 siblings, 2 replies; 13+ messages in thread
From: awdorrin @ 2011-11-15 20:30 UTC (permalink / raw)


Given an IF statement such as the following:

if X = Y and not A and B

How does GNAT handle the processing of the conditional statements?
Will "X = Y" be processed first, and if false, will the rest be
skipped?

Reason I'm asking is I'm porting code, and it appears as if all of the
statements are being evaluated, even though the "X = Y" part is
already false.

I'm not sure if there is some optimization going on and if there is,
is there a compiler flag to disable it.

Guessing the best thing to do would be to rewrite the code to
something clearer like:

if X = Y then
  if not A then
   if B then ...

But I was curious since this is something that is probably a hundred
places through out this collection of source code.

Thanks
-Al



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-11-17  0:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-15 20:30 GNAT 4.4.5 order of conditional processing? awdorrin
2011-11-15 20:54 ` Niklas Holsti
2011-11-15 21:07   ` awdorrin
2011-11-15 21:23     ` Vinzent Hoefler
2011-11-15 21:49       ` awdorrin
2011-11-16 21:31         ` Gautier write-only
2011-11-16 22:40           ` Adam Beneschan
2011-11-17  0:00             ` Adam Beneschan
2011-11-15 23:08 ` Jeffrey Carter
2011-11-16  1:18   ` Adam Beneschan
2011-11-16  5:33     ` tmoran
2011-11-16 17:52       ` awdorrin
2011-11-16 20:01         ` Simon Wright

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