Forward referencing functions in D
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Oct 16 20:24:09 UTC 2020
On Fri, Oct 16, 2020 at 08:04:07PM +0000, Imperatorn via Digitalmars-d-learn wrote:
[...]
> I think it might be just because you havent defined the function yet
> at that point.
That's not correct; the following works:
module mymodule;
void func() {
forwardfunc();
}
void forwardfunc() {
}
However, this only applies in module scope. If they were declared inside
a function body, forwardfunc must be declared before func.
T
--
It is impossible to make anything foolproof because fools are so ingenious. -- Sammy
More information about the Digitalmars-d-learn
mailing list