Is this nogc? dmd and gdc disagree
tsbockman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 11 05:41:47 PST 2016
On Thursday, 11 February 2016 at 12:55:02 UTC, rcorre wrote:
> Though it appears (in 2.070 at least) that zip's range
> primitives aren't nogc:
I took a look at the source code for `zip()`, and the cause of
this deficiency is that `Zip` takes a `StoppingPolicy` as a
runtime parameter, rather than a compile-time parameter as it
should.
`empty()` and `popFront()` can both throw - but only if
`StoppingPolicy.requireSameLength` is selected. The default is
`StoppingPolicy.shortest`.
This design dates back to 2009, which is probably before
`nothrow` was implemented, and certainly before `@nogc`.
More information about the Digitalmars-d-learn
mailing list