comp.lang.ada
 help / color / mirror / Atom feed
From: Warren <ve3wwg@gmail.com>
Subject: X := X; Compiler Warning?
Date: Mon, 12 Apr 2010 14:40:04 +0000 (UTC)
Date: 2010-04-12T14:40:04+00:00	[thread overview]
Message-ID: <Xns9D586C840409EWarrensBlatherings@188.40.43.213> (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



             reply	other threads:[~2010-04-12 14:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12 14:40 Warren [this message]
2010-04-12 16:27 ` X := X; Compiler Warning? John B. Matthews
2010-04-12 17:39   ` Warren
replies disabled

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