Loading...

xcode-users@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

C++: std::ostringstream default ctor problems Dan Caugherty Sun Sep 27 19:00:27 2009

Hey all --

This may or may not be a relevant topic for this group, so please
gently point me to the right place if not. If so, then please read on.

I have the following snippet of code compiling successfully on Xcode
3.2 and GCC 4.2:

const std::string
foobar::to_string() const
{
   std::ostringstream oss;
   oss << *this;       // gdb says odd things happen right here
   return oss.str();
}

Under GCC 4.2, I see the following error:

 malloc: *** error for object 0xa0451db0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

..and sure enough, the ostringstream instance is trying to free a
buffer that it never allocated. Naughty naughty.

Is this a known issue with GCC 4.2, or am I just doing something wrong?

Thanks,
-- Dan Caugherty
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]