Forward referencing functions in D

H. S. Teoh hsteoh at
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() {

	void forwardfunc() {

However, this only applies in module scope. If they were declared inside
a function body, forwardfunc must be declared before func.


It is impossible to make anything foolproof because fools are so ingenious. -- Sammy

More information about the Digitalmars-d-learn mailing list