Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: rickg22 on May 25, 2007, 02:58:14 am

Title: debugger plugin - WARNING! uninitialized variable
Post by: rickg22 on May 25, 2007, 02:58:14 am
I was compiling today's svn, and noticed the following error:

G:\projects\codeblocks\src\plugins\debuggergdb\debuggergdb.cpp:951: warning: 'tgtIdx' might be used uninitialized in this function

The line is:
            int tgtIdx = project->SelectTarget(tgtIdx);

It worries me. The SelectTarget uses as the parameter, an initialized value. How to handle this?
Title: Re: debugger plugin - WARNING! uninitialized variable
Post by: MortenMacFly on May 25, 2007, 07:55:45 am
            int tgtIdx = project->SelectTarget(tgtIdx);
Yay, thats a bad one. I think it should be:
Code
  int tgtIdx = project->SelectTarget();
This will use the default value -1 as initial target which is good since the requested build target is not valid (see line 949). Don't know who did that, but I suspect Yiannis... :twisted: ;-)
With regards, Morten.
Title: Re: debugger plugin - WARNING! uninitialized variable
Post by: mandrav on May 25, 2007, 09:01:05 am
            int tgtIdx = project->SelectTarget(tgtIdx);
Yay, thats a bad one. I think it should be:
Code
  int tgtIdx = project->SelectTarget();
This will use the default value -1 as initial target which is good since the requested build target is not valid (see line 949). Don't know who did that, but I suspect Yiannis... :twisted: ;-)
With regards, Morten.

Don't suspect... be sure it was me :lol:.
Someone correct this please (sorry, my time is really limited atm).
Title: Re: debugger plugin - WARNING! uninitialized variable
Post by: Biplab on May 25, 2007, 11:18:45 am
Someone correct this please (sorry, my time is really limited atm).

Corrected. :)
Title: Re: debugger plugin - WARNING! uninitialized variable
Post by: rickg22 on May 26, 2007, 12:16:36 am
Yay! I spotted a bug made by Yiannis!  8)

*Back in the saddle again...*  :lol: