[cxx-abi-dev] Mangling of string literals versus variadic templates

John Spicer jhs at edg.com
Tue Dec 17 20:33:50 UTC 2013


On Dec 17, 2013, at 3:01 PM, Sean Hunt <scshunt at csclub.uwaterloo.ca> wrote:

> On Tue, Dec 17, 2013 at 2:57 PM, John McCall <rjmccall at apple.com> wrote:
> On Dec 17, 2013, at 11:12 AM, David Vandevoorde <daveed at edg.com> wrote:
> > On Dec 16, 2013, at 8:33 PM, John McCall <rjmccall at apple.com> wrote:
> >> On Dec 16, 2013, at 5:10 PM, Richard Smith <richardsmith at google.com> wrote:
> >>> Consider:
> >>
> >> Remind me why it’s impossible to go back to the committee and repeatedly weaken any remaining guarantees about string literal addresses until none of this is important?
> >
> > I don't know if it's impossible or not, but I suspect it would be controversial.  (I, at least, would be opposed.)
> 
> Really?  You feel that having really strong guarantees about the address of a string literal is the right thing to do?  Like, it’s worth significantly increasing build times, code size, and launch times over?
> 
> John.
> 
> I don't see a situation where baz() below returns false really being defensible:
> 
> a.h:
> 
> inline const char* foo() { return ""; }
> const char* bar();
> 
> a.c:
> 
> const char* bar() { return foo(); }
> 
> b.c:
> 
> const bool baz() { return foo() == bar(); }

I don't think that baz() is guaranteed to return true if foo() were not inline.   I admit it would be strange if the string literal in foo had a different address when called different times, but I think that is permitted by the language.

Also, if you had two different functions that return the same string literal, they may or may not compare the same.

John.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20131217/2b6a630a/attachment.html>


More information about the cxx-abi-dev mailing list