View Single Post

   
  #5 (permalink)  
Old 01-04-2008, 11:30 PM
m v
 
Posts: n/a
Default Re: Apparently two different std:string classes being used by the same program

Paul,


>
> I bet it does, in which case some other header of yours likely has
> unbalanced '#pragma pack(1)'
>


Paul,

Thanks a lot!

That was it.
There was an open #pragma options align=packed
in an .h file that was included indirectly with some recent changes.
It needed to be closed with #pragma options align=reset.

So, anyone, if you ever get a bad pointer or garbage from
string::c_str() or
a bad value from string::length() on a std::string that was created in
another compile module, check for packing / align mismatches. I guess
this goes for most
template implemented classes. Be very careful with pack pragma.

Regards,
Michael
Reply With Quote