On 9/19/07, Michael L Torrie <[EMAIL PROTECTED]> wrote:
> Well, if I understand your code correctly, you're returning a char *
> pointer (likely const char *) to the internal buffer of the out
> stringstream, correct?  If so, then on return the caller receives a
> pointer to the internal buffer of the out object which lived in the
> stack frame of the itoa call, which no longer exists.

You're exactly right.  That's why itoa in the C standard lib has you
pass your own char[] into them.  They're expecting the caller to
allocate and babysit the buffer.

Oh the joys of life with manual memory management :-).

-Bryan

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to