Board index » cppbuilder » int with wrong initial value

int with wrong initial value


2005-10-02 01:00:12 AM
cppbuilder101
I have a int initialised to 1 in release compilations and 0 in debug
compilations. It is specifically initialised to 0 in the source code.
It is g in the code below. I have shown the surrounding data.
std::vector<unsigned char>
d1,
d2;
int
g=0,
p,
c=0;
bool
dn=false,
pe=false;
Fraser.
 
 

Re:int with wrong initial value

"Fraser Ross" <fraserATmembers.v21.co.unitedkingdom>writes:
Quote
I have a int initialised to 1 in release compilations and 0 in debug
compilations. It is specifically initialised to 0 in the source code.
It is g in the code below. I have shown the surrounding data.

std::vector<unsigned char>
d1,
d2;
int
g=0,
p,
c=0;
bool
dn=false,
pe=false;
Can you cause the behavior to be reproducible in a complete,
compilable and executable program?
 

Re:int with wrong initial value

"Fraser Ross" <fraserATmembers.v21.co.unitedkingdom>wrote:
Quote

It is specifically initialised to 0 in the source code.
It is g in the code below.
It's impossible to say because you didn't show enough code
but my first guess would be that you have more than one 'g'
defined.
My next guess would be that you're using the OnCreate event
and my final guess would be that you're changing the value of
g in code.
~ JD
 

{smallsort}

Re:int with wrong initial value

It wasn't g, it is a unsigned int class member. I check its value and
its 1 then some code is ran which doesn't change it then its value is 4.
The code is linked from a LIB file.
Fraser.
 

Re:int with wrong initial value

A missing return keyword was the problem.
 

Re:int with wrong initial value

"Fraser Ross" <fraserATmembers.v21.co.unitedkingdom>wrote:
Quote

It wasn't g, it is a unsigned int class member.
Then you described your problem poorly.
~ JD