--- Comment #6 from deadalnix <> 2011-12-02 10:59:31 PST ---
(In reply to comment #4)
> Rather than trying to fix the C++ mangling, wouldn't it make more sense to
> disallow 'shared' in extern(C++) declarations?

As thoses concept doesn't exists in C++, this is up to the C++ programmer to
ensure that something is shared or not. Sometime, C++ code is just made to
handle shared data, it is just not explicit.

In this case, you ends up using convoluted casts to handle everything.

I have a practical case : start a thread from C++, but that could interract
with D (so you must go throw D's way of starting thread). You end up writing
something like this :
alias extern(C++) void* function(void*) EntryPoint;
extern(C++) void* D_start_thread(EntryPoint entryPoint, void* userData) {
    Tid tid = spawn(function void(EntryPoint entryPoint, shared void* userData)
        entryPoint(cast(void*) userData);
    }, entryPoint, cast(shared void*) userData);

    return cast(void*) [tid].ptr;

So I would recommand to ignore shared in mangling of C++ function and mangle
immutable as const. It is up to the programmer to ensure that thoses are right

inout can't be handled nicely so it should generate a compile time error.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to