Re: C++ thingies



On 29 May 2001 03:45:45 +0200, Drazen Kacar wrote:
> 
> So, the question is: is that page correct about underscores and if so,
> shouldn't public headers be without functions named like that?

yes & yes

> It's perfectly possible that something like:
> 
> extern "C" {
> void foo__bar(int);
> }
> 
> is legal, but the page doesn't say anything about that option and I
don't
> know anything about C++, so here you go.

a nm of an object file of a project where I'm working right now shows:
...
000003d0 T create_2bits__9HistogramRC5Image
000009e0 T create__9HistogramRC5ImageRCQ29Histogram4Type
00000720 T create_gray__9HistogramRC5Image
...

Now, if I add a

extern "C" {
 void create_2bits__9HistogramRC5Image(void) {
 }
}

to the project (in the same, or in other compilation unit), the linker
will complain 'cause of the collision.

I don't need to explain the potential consequences of having such a
funcion in a public library for the C++ people (but anyway, you should
name your functions as a mad to actually collide with the compiler).

Cheers,

-- 
Joaqun Cuenca Abela
cuenca celium net





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]