Why isn't purity & co. inferred for all functions?

Walter Bright newshound2 at digitalmars.com
Sat May 12 11:18:23 PDT 2012


On 5/12/2012 1:12 AM, Paulo Pinto wrote:
> Am 12.05.2012 05:33, schrieb Walter Bright:
>> On 5/11/2012 4:48 PM, Trass3r wrote:
>>>> I thought Purity was marked in the mangled name, so that should give
>>>> a link
>>>> error.
>>>
>>> Good point.
>>
>> Doesn't work if any modules declare:
>>
>> extern int foo();
>
> Those functions would always be considered impure, unless the programmer says
> otherwise in the extern declaration.

Sure, but if foo() is defined in A, imported in B, and just extern declared in 
C, then it won't link.

I.e. the name mangling shouldn't change whether or not the compiler sees the source.


More information about the Digitalmars-d mailing list