forcing "@nogc" on class destructors

Kapps via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 20 16:29:21 PST 2015


On Tuesday, 20 January 2015 at 18:12:27 UTC, ketmar via 
Digitalmars-d wrote:
> let's see how this proposal will be rejected. will there be 
> some sane
> reasons, or only the good old song about "broken code"? make 
> your bets!

Lots of functions can theoretically allocate, but don't in the 
way you call them. For example, a function that checks for 
invalid arguments and throws an exception if any are passed in. 
It can't be @nogc because it throws, but it's perfectly valid to 
call in a constructor.

Also, what about classes allocated with malloc/emplace that are 
then destroyed/freed?


More information about the Digitalmars-d mailing list