return "chars"
char* foo () {
return "abc";
}
I compiled the above code both with MSVC and GCC for PPC. The string
"abc" is generated as a global entity. Thus (1) foo doesn't return a
temporary
and (2) no deallocation is necessary.
What does the standard say about this? Is this a "feature" I can rely on on
every
platform?
.
Relevant Pages
- Re: Simple question on memory behavior
... thus the string would not be collected. ... Foo a = new Foo; ... a.MyName = "abc"; ... would keep the original object around because ... (microsoft.public.dotnet.framework.clr) - Re: Forth Frustrations
... If you have a word that accepts a string then it's easy to get the ... we could do "FOO to tell the compiler to keep FOO ready, ... The address was HERE after the child was completed. ... lay down the two literals and then the execute, ... (comp.lang.forth) - Re: Forth Frustrations
... If you have a word that accepts a string then it's easy to get the ... we could do "FOO to tell the compiler to keep FOO ready, ... The address was HERE after the child was completed. ... lay down the two literals and then the execute, ... (comp.lang.forth) - Re: Forth Frustrations
... If you have a word that accepts a string then it's easy to get the ... we could do "FOO to tell the compiler to keep FOO ready, ... The address was HERE after the child was completed. ... lay down the two literals and then the execute, ... (comp.lang.forth) - Re: Forth Frustrations
... If you have a word that accepts a string then it's easy to get the ... we could do "FOO to tell the compiler to keep FOO ready, ... The address was HERE after the child was completed. ... lay down the two literals and then the execute, ... (comp.lang.forth) |
|