Sam Lawrance wrote:

> You can't return a reference to s, because it goes out of scope as soon 
> as the function exits.  You could return a copy of s by value, or a 
> pointer to a heap allocated copy.

Ah, ok, something like this:

    std::string
    return_string (void)
    {
        std::string s = "asdasd" ;      
        return s ; 
    }


Thanks Sam.

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"One in four [British] Muslims sympathises with motives of terrorists."
-- http://www.telegraph.co.uk/news/main.jhtml?xml=/news/2005/07/23/npoll23.xml
_______________________________________________
coders mailing list
coders@slug.org.au
http://lists.slug.org.au/listinfo/coders

Reply via email to