comp.lang.ada
 help / color / mirror / Atom feed
* X := X; Compiler Warning?
@ 2010-04-12 14:40 Warren
  2010-04-12 16:27 ` John B. Matthews
  0 siblings, 1 reply; 3+ messages in thread
From: Warren @ 2010-04-12 14:40 UTC (permalink / raw)


This weekend, I discovered a problem after some
effort in debugging. The culprit was something
stupid like this:

  Position_X : Line_Index := ...
begin

  loop
    ..
    Position_X := Position_X;  -- whoops
    ..
    exit when ...;
  end loop;

Obviously, that should have been coded as:

    Position_X := Position_X + 1;

As outlined here, it is trivial to spot. 

But with the longer variable names (in the original
code), I somehow missed it in amongst all of the
other statements.

Now isn't this something that is normally reported
as a warning?  I'm using gnat, so perhaps I need an
additional compiler option.

Thanks, Warren



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

end of thread, other threads:[~2010-04-12 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-12 14:40 X := X; Compiler Warning? Warren
2010-04-12 16:27 ` John B. Matthews
2010-04-12 17:39   ` Warren

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