 |
|
|
|
Actions
|
|
[ Date Prev][ Date Next][ Thread Prev][ Thread Next][ Date Index][ Thread Index]
Re: [cxx-abi-dev] Scope encoding of string literals in default arguments questions
- To: scott douglass <sdouglass@xxxxxxx>, "cxx-abi-dev@xxxxxxxxxxxxxxxx" <cxx-abi-dev@xxxxxxxxxxxxxxxx>
- Subject: Re: [cxx-abi-dev] Scope encoding of string literals in default arguments questions
- From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
- Date: Sun, 10 Nov 2002 22:52:42 -0800
--On Friday, November 01, 2002 11:47:59 AM +0000 scott douglass
<sdouglass@xxxxxxx> wrote:
Hi,
I have some questions about the scope encoding of string literals in
inline functions. Consider,
bool g(const char*);
inline const char* f1(const char* p = "world"); // _ZZ2f1Es ?
inline const char* f1(const char* p) {
g(p);
g("hello"); // _ZZ2f1Es_0 ?
g("world"); // _ZZ2f1Es ?
}
I think that the only consistent thing to do is to move the default
argument into the callers; that is where it will be emitted.
I'll also suggest some minor clarifications to the wording in 5.1.6:
"Note that this assumes that the same string literal occurring twice in
a given function in fact represents a single entity, i.e. has a unique
address."
would be better as
"Note that this means that the same string literal occurring twice in a
given inline function in fact represents a single entity, i.e. has a
unique address. It also means that string literals in inline functions
do not "tail-share", i.e. the string literals "abc" and "bc" are
completely distinct in inline functions."
Why?
And
"even if subsequent optimization makes some of them unnecessary."
would be better as
"even if subsequent optimization makes some of them unnecessary or base
or member initializer expressions are re-ordered."
Agreed; I made that change.
By the way, the ABI document's HTML has two occuranes "#scope-encoding"
that should be "#mangling-scope".
Thanks; those are now fixed.
--
Mark Mitchell mark@xxxxxxxxxxxxxxxx
CodeSourcery, LLC http://www.codesourcery.com
|
|