Author Topic: debugger plugin - WARNING! uninitialized variable  (Read 6933 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
debugger plugin - WARNING! uninitialized variable
« 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?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: debugger plugin - WARNING! uninitialized variable
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: debugger plugin - WARNING! uninitialized variable
« Reply #2 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).
Be patient!
This bug will be fixed soon...

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: debugger plugin - WARNING! uninitialized variable
« Reply #3 on: May 25, 2007, 11:18:45 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.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: debugger plugin - WARNING! uninitialized variable
« Reply #4 on: May 26, 2007, 12:16:36 am »
Yay! I spotted a bug made by Yiannis!  8)

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