[comp.lang.c++] botched example

gautron@litp.ibp.fr (Philippe GAUTRON) (08/16/90)

Subject: botched example
--text follows this line--

Pitfall or botched example, I dislike the following example, but I'm sure
that, one day or another, someone will try it (if not already done!)
Hayssam Saleh wrote it.

class X {};
class Y {};
class U {};
class UiN214cT11f {};

void f (X,X,X,X,X,X,X,X,X,X, Y, X, UiN214cT11f) {}
void f (X,X,X,X,X,X,X,X,X,X, Y, Y, U, int,int,int,char,Y,float){}

The two f will be encoded with a same name:

char f__F1XN911YT111UiN214cT11f
char f__F1XN911YT111UiN214cT11f

-----------------------
Philippe GAUTRON			UUCP:	gautron@rxf.ibp.fr
Rank Xerox France - LITP
Universite Paris 6
4 place Jussieu
75252 PARIS CEDEX 05
France

schwartz@groucho.cs.psu.edu (Scott Schwartz) (08/31/90)

In article <3328@litp.ibp.fr> gautron@litp.ibp.fr (Philippe GAUTRON) writes:

| class X {};
| class Y {};
| class U {};
| class UiN214cT11f {};
| void f (X,X,X,X,X,X,X,X,X,X, Y, X, UiN214cT11f) {}
| void f (X,X,X,X,X,X,X,X,X,X, Y, Y, U, int,int,int,char,Y,float){}
|
| char f__F1XN911YT111UiN214cT11f
| char f__F1XN911YT111UiN214cT11f

Even easier (g++ 1.37.1):

int foo(int i) {}
int foo__Fi;

will clash.

hayssam@litp.ibp.fr (Saleh HAYSSAM) (09/03/90)

Just take a look at the paragraph "keywords" of the ARM C++ page 7 :

"... identifiers containig a double underscore (__) are reserved for use 
                                                        --------
by C++ implementations and standard librairies and should be avoided by users."



 Hayssam Saleh
 hayssam@litp.ibp.fr