where is the string literal allocated ? On the stack ?
Matthew Woehlke
mw_triad@users.sourceforge.net
Fri Apr 20 15:57:00 GMT 2007
Michael wrote:
> David Sveningsson apparently replied privately?
>> Michael Gong skrev:
>>> Where is the string literal allocated ? Is it on the stack ?
>>
>> Hi, IIRC they are put in the .DATA section.
>
> Forgive my silly question: what's IIRC means ?
It means you should STFW for IIRC. ;-)
http://en.wiktionary.org/wiki/IIRC (in this case, #1 or #2, not #3)
http://www.google.com/search?q=stfw ...the first hit will do :-)
> My understanding is : there is a global string literal pool, so the
> string literal , like "abc", is not allocated on stack. Is it correct ?
Right, it lives in one of the read-only segments. As noted in my other
message it can't live on the stack or foo() would be broken, and it
isn't (except for the return type missing the 'const' qualifier which is
VERY broken).
--
Matthew
<insert bad pun... on second thought, better not>
More information about the Gcc-help
mailing list