O
Olaf Martens
Greetings!
Please consider the following piece of program code (note that I have stripped
quite a lot of code here):
int foo(void)
{
unsigned short l_valbuf; // address of this goes to another function
Objtype *l_item; // I want to get this one's data!
..
..
..
l_item->QueryData(&l_valbuf,BITMASK);
}
l_valbuf is to act as a buffer for a two-byte data entity to be read out from
an object refrenced by l_item.
Now, when I attempt to read out a piece of data (as defined by BITMASK) and
have it put into the local variable l_valbuf I get absolute nonsense (although
the address QueryData() receives is correct - I already have verified this).
But when I make l_valbuf global, everything works just fine. *boggle*
Anyone around who has experienced this or a similar problem?
Any ideas how to make this thing work properly with local variables? Or is
this some sort of subtle bug within g++?
I'm using GNU C++ version 3.1.1-24 for Linux (underlying kernel is 2.4.21-166)
Any help would be greatly appreciated.
Please consider the following piece of program code (note that I have stripped
quite a lot of code here):
int foo(void)
{
unsigned short l_valbuf; // address of this goes to another function
Objtype *l_item; // I want to get this one's data!
..
..
..
l_item->QueryData(&l_valbuf,BITMASK);
}
l_valbuf is to act as a buffer for a two-byte data entity to be read out from
an object refrenced by l_item.
Now, when I attempt to read out a piece of data (as defined by BITMASK) and
have it put into the local variable l_valbuf I get absolute nonsense (although
the address QueryData() receives is correct - I already have verified this).
But when I make l_valbuf global, everything works just fine. *boggle*
Anyone around who has experienced this or a similar problem?
Any ideas how to make this thing work properly with local variables? Or is
this some sort of subtle bug within g++?
I'm using GNU C++ version 3.1.1-24 for Linux (underlying kernel is 2.4.21-166)
Any help would be greatly appreciated.