See below for my reply.
----Original Message Follows----
From: Eljay Love-Jensen <eljay@xxxxxxxxx>
To: Neo Anderson <neo_in_matrix@xxxxxxx>, gcc-help@xxxxxxxxxxx
Subject: Re: Puzzled by const string& parameter
Date: Fri, 24 Jun 2005 09:22:26 -0500
Hi Neo,
>It gives the impression that it is a gcc specific feature and the standard
does not require this.
No, that is not the case. That's why I specifically mentioned that the
error is REQUIRED by ISO 14882.
Can you copy/paste for me? Thanks.
>Because even I pass a temporary string& s and modifiy it, it won't make
any damages to my program.
What happens if you inadvertently pass in a temporary?
// i is initialzed by foo().
void foo(long& i);
...
int bar; // Uninitialized, but we'll initialize with foo().
foo(bar); // DOH!
I don't think your example gives me anything. int and long are different
types (although on most 32-bit platforms, they are all 4 bytes). How about
this:
void foo(long& i);
...
long bar;
foo(bar);
Can you tell me where the DOH is?