[Qt-interest] [Newbie question] Why string.toAscii().data() doesn't work?

Andreas Pakulat apaku at gmx.de
Thu Mar 26 16:14:19 CET 2009


On 26.03.09 12:23:15, Giancarlo Amati wrote:
> 
> So at the end of the story it's only a matter of the statement line..!?

Not quite, its a matter of temporary object lifetime. In

foo( bar().baz() );

the object returned by bar() lives until the foo() call is completely done.
So even if baz returns some internal data of the bar-object that internal
data will live until the foo() call has completed. So with the above
there's only one pitfal: If foo() stores the internal data from baz()
itself and later on something tries to access it.

Andreas
 
-- 
Someone is speaking well of you.

How unusual!



More information about the Qt-interest-old mailing list