Prevent macro expansion of mblen

Gabriel Dos Reis gdr@codesourcery.com
Sat Dec 30 09:05:00 GMT 2000


Alexandre Oliva <aoliva@redhat.com> writes:

[...]

| > 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.

After a break and a good sleep, I can now understand your sentiment:
your proposed implementation can't break Jack's program.  Sorry for
the confusion.

However, the second example I showed in my reply to rth's message
won't work.  It consist's in supporting the following existing
pratice:

	// file a.c coming from a "C"-program
	#include <stddef.h>

	void f()
	{
		extern int mblen(const char*, size_t);
		// ...
	}

	
	// file b.C part of a "C++"-program
	#include <cstdlib>

	extern "C" void f();

	void g()
	{
		f();
	}

We need a way to make the call to f() work.  Do you see what I'm
trying to say?

(As a note, what I described above isn't a language "lawyering", I
have in front of me, several C-libraries using the above idioms)

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com


More information about the Libstdc++ mailing list