This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Prevent macro expansion of mblen
Richard Henderson <rth@redhat.com> writes:
| On Thu, Dec 28, 2000 at 07:28:11PM +0100, Gabriel Dos Reis wrote:
| > But protecting the macro expansion doesn't make 'mblen' to have C
| > linkage.
|
| So surely all that was needed is to add `extern "C"' to the
| original patch?
Ok.
| ... (Though frankly I don't understand the
| implications of C linkage on an inline function.)
It is quality of implementation issue. The intent is twofold:
1) help the compiler catch at compile-time constructs like:
#include <xxx.h> // this happpens to include <stdlib.h>
// the user doesn't know
// The following is silly, but happens in user code from time to
// time.
namespace MyNamespace {
// my "improved" version
int mblen(const char* p, int l) // WRONG
{ /* ... */ }
}
2) support existing practice (mainly in the C community)
int f()
{
extern int mblen(const char*, int);
// ...
}
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com