On Sunday, 24 July 2016 at 23:10:18 UTC, Dicebot wrote:
@nogc functions must never ever trigger GC collection cycle, not under any possible circumstances. Otherwise the attribute serves no purpose.

The fact that you can use malloc() in a @nogc function invalidates this argument. There are many ways for someone publishing a piece of code or DUB package to be irresponsible about memory management. Adding this would not make it any more likely. Adding @gc to a piece of code to bypass @nogc is not something that could be done by accident.

Imagine though, if there was a DUB package that provided some base class that had its virtual methods annotated with @nogc. If I downloaded the package, and decided that using GC was perfectly fine in my application, I would be screwed if I wanted to inherit one of the classes from that package.

    Bit

Reply via email to