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 29, 2000, Gabriel Dos Reis <> wrote:

>  * In the first case, we need to #undef the macro and introduce a
>    declaration in namespace std;

This that's what we should do.  mblen must be a function, according to
the C99 Standard (even though an additional implementation as a macro
isn't forbidden).

> If the target provides *both* forms then it is OK to #undef the macro
> and introduce a function declaration with "C" linkage in namespace std.

Would you mind taking this issue over from this point?

> Consider a target which provides only the macro version (I'm not sure
> that is valid, but let's make that assumption for the sake of
> exposition).

Ok, but now let's assume that's not the case.  In which situation does
the implementation I propose could break Jack's program?  That's what
I don't understand.

> If we didn't mark the corresponding function with a C
> linkage then the following will be OK

I don't see why the C linkage would make any difference in this case.
It doesn't seem to me like it would prevent Jack's ``improved''
version of mblen from compiling, since Jack's improved version isn't
extern "C" itself, so it doesn't clash with the definition supplied by
the C library or by whatever definition we might provide in namespace

I must still be missing something obvious :-(

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]