News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

debugger plugin - WARNING! uninitialized variable

Started by rickg22, May 25, 2007, 02:58:14 AM

Previous topic - Next topic

rickg22

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?

MortenMacFly

Quote from: rickg22 on May 25, 2007, 02:58:14 AM
            int tgtIdx = project->SelectTarget(tgtIdx);
Yay, thats a bad one. I think it should be:

  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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

mandrav

Quote from: MortenMacFly on May 25, 2007, 07:55:45 AM
Quote from: rickg22 on May 25, 2007, 02:58:14 AM
            int tgtIdx = project->SelectTarget(tgtIdx);
Yay, thats a bad one. I think it should be:

  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).
Be patient!
This bug will be fixed soon...

Biplab

Quote from: mandrav on May 25, 2007, 09:01:05 AM
Someone correct this please (sorry, my time is really limited atm).

Corrected. :)
Be a part of the solution, not a part of the problem.

rickg22

Yay! I spotted a bug made by Yiannis!  8)

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