RE: different return value from same variable



Quoth marty moore:
> I have a wierd C++/gtkmm problem. I have two functions which return the
value 
> of the same variable  - and produce different values for that variable.
I'm 
> guessing it's not a gtkmm problem, but I'm not sure. Please bear with me.
[...]
  e_opmode  get_opmode () { return _opmode; }
  e_opmode  get_opmode2 ();
[...]

The first can be inlined by the compiler, the second cannot.  If they are
producing different results, it means that the two (or more) compilation
units are being compiled with different settings, resulting in the structure
being seen as different sizes.  (Typical culprits: byte packing/alignment,
calling convention, treatment of vtables, exceptions, member pointers; also
possibly other members with sizes the two compilation units don't agree on,
for either the same reasons or incompatible #defines or typedefs.)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]