E
Equus
Hi - sorry! My previous message got screwed up, evidently :-$
I have a weird case of a pointer, passed as an argument to a method,
not being assigned to the value it should.
My method is like this:
bool myClass::myMethod(param a, toBeUpdated* b)
{
if(a == myDataMember) {
b = &someData;
return true;
}
else return false;
}
I call it via a pointer to an object:
myClass* s;
toBeUpdated* updated = 0;
if( s->myDataMember(a,updated) ) {
cout << updated->something << endl; // SEGFAULTS!
}
else {
cout << "Did not return anything in 'updated'" << endl;
}
Now, the issue is that for some reason, when the method returns true,
the value assigned to b in the method does not make it out - in other
words, the value of 'updated' is not changed by calling the method.
Am I missing a trick, or is this a bug in gcc?
Thanks,
Chris
I have a weird case of a pointer, passed as an argument to a method,
not being assigned to the value it should.
My method is like this:
bool myClass::myMethod(param a, toBeUpdated* b)
{
if(a == myDataMember) {
b = &someData;
return true;
}
else return false;
}
I call it via a pointer to an object:
myClass* s;
toBeUpdated* updated = 0;
if( s->myDataMember(a,updated) ) {
cout << updated->something << endl; // SEGFAULTS!
}
else {
cout << "Did not return anything in 'updated'" << endl;
}
Now, the issue is that for some reason, when the method returns true,
the value assigned to b in the method does not make it out - in other
words, the value of 'updated' is not changed by calling the method.
Am I missing a trick, or is this a bug in gcc?
Thanks,
Chris