This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Prevent macro expansion of mblen

On Dec 28, 2000, Gabriel Dos Reis <> wrote:

> We want all C-functions, whether there are shadowed (i.e. brought in
> scope through <cxxx> or <xxx.h> headers) have C linkage  -- this
> ensures that those names ultimately refer to the same entities --

Will you please explain again what your plan is to accomplish this in
case the C library offers a standard function as both a preprocessor
macro and a function with C linkage in the global namespace, and in
case it is only offered as a preprocessor macro?

I see your solution is ok for the latter, but not for the former,
which is the case on IRIX 5.  If mblen were defined as an inline
extern "C" function, there would be two different implementations of
the same function, both of them with C linkage, which (I think)
violates the ODR.

Maybe we should just #undef the macro, in this case, which would also
get us rid of the optimization provided by the preprocessor macro?

What I don't understand is why it is so important that the inline
function in the std namespace be extern "C".  The reasons you give are
sound for the second case, but not for the first, which is the one at
hand.  Maybe you're just misunderstanding the situation?

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  aoliva@{,}
CS PhD student at IC-Unicamp        oliva@{,}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]