What storage does std::string::c_str() use?

From: Vyacheslav Kononenko (vyacheslav_at_kononenko.net)
Date: 09/08/04


Date: 8 Sep 2004 12:39:58 -0700

All,

If I am not mistaken I had some problems with code like this:

std::string foo, bar;
...
somefunc( foo.c_str(), bar.c_str() );

Problem was that c_str() used buffer shared btw instances of
std::string in that implementation. I did not find anything that
standart would explicitly say about this case. So what would you say?

Thanks,
Slava



Relevant Pages

  • Re: Insert with response
    ... FooBar, there's no way and no need to put them in synch. ... column in the foo table to 250 calumns in the bar table. ... set statistics time off ...
    (microsoft.public.sqlserver.programming)
  • Re: Magic function
    ... processing objects created in root at depth 3 ... root obj2 at depth 3 ... processing objects created in foo at depth 2 ... processing objects created in bar at depth 0 ...
    (comp.lang.python)
  • Re: Any Clojure users here?
    ... (let [my-list (foo x)] ... If the stack depth is N when you call baz, it's only N+3 in bar and N+2 ... It is N+3 in map, but map creates a lazy sequence object rather than ... a Java method call. ...
    (comp.lang.lisp)
  • Re: Closing parenthesis in functions definition followed by its call
    ... return [bar, foo]; ... Evaluating the ArrayLiteral, the identifiers `foo` and `bar` must be resolved. ... The identifier `foo` is resolved on the VO, however `bar` cannot be resolved to an identifier and so a ReferenceError is produced. ...
    (comp.lang.javascript)
  • Re: A Plain English Compiler
    ... MOVE bar TO foo ... in natural English appear to be absolutely required in this language: ... But in "Plain English" it is different: ...
    (comp.compilers)