On Phobos GC hunt

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 8 13:10:11 PDT 2014


On 10/8/14, 1:01 PM, Andrei Alexandrescu wrote:
> On 10/8/14, 1:13 AM, Johannes Pfau wrote:
>> Am Tue, 07 Oct 2014 21:59:05 +0000
>> schrieb "Peter Alexander" <peter.alexander.au at gmail.com>:
>>
>>> On Tuesday, 7 October 2014 at 20:13:32 UTC, Jacob Carlborg wrote:
>>>> I didn't look at any source code to see what "new" is actually
>>>> allocating, for example.
>>>
>>> I did some random sampling, and it's 90% exceptions, with the
>>> occasional array allocation.
>>>
>>> I noticed that a lot of the ~ and ~= complaints are in code that
>>> only ever runs at compile time (generating strings for mixin). I
>>> wonder if there's any way we can silence these false positives.
>>
>> Code in if(__ctfe) blocks could be (and should be) allowed:
>> https://github.com/D-Programming-Language/dmd/pull/3572
>>
>> But if you have got a normal function (string generateMixin()) the
>> compiler can't really know that it's only used at compile time. And if
>> it's not a template the code using the GC will be compiled, even if
>> it's never called. This might be enough to get undefined symbol errors
>> if you don't have an GC, so the error messages are kinda valid.
>
> That's a bummer. Can we get the compiler to remove the "if (__ctfe)"
> code after semantic checking?

Or would "static if (__ctfe)" work? -- Andrei



More information about the Digitalmars-d mailing list