C++/C mangleof inconsistency for OS X

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 22 11:12:13 PDT 2015


On 22 April 2015 at 19:59, Michel Fortin via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 2015-04-22 16:32:55 +0000, Dan Olson <zans.is.for.cans at yahoo.com> said:
>
>> Since the compile chain knows whether the target system prepends an
>> underscore, I wonder if it can be bubbled up into some compiler trait or
>> version that prevents writing versioned code based on system.  I think
>> it would help gdc much as it has many targets, and many prepend
>> underscore to symbols.  It would help with unittests like
>> compilable/cppmangle.d that would have to be tailored for every OS.
>> that uses gcc3 style C++ mangling.
>
>
> And you think it's safe to assume all symbols on OS X will always have an
> underscore as a prefix just because symbols for C and C++ stuff do? (Hint:
> some Objective-C symbols don't start with "_".)
>

I think I've argued this before about pragma(mangle) - it's dangerous
to put any asserts in the testsuite surrounding this or to write any
library wrappers around it.

(FYI - last time I checked GDC goes ahead and applied target-specific
mangling on-top of pragma(mangle).  So you can relax and assume
nothing about the target).


More information about the Digitalmars-d mailing list