Function prototype + definition in the same file
Steven Schveighoffer
schveiguy at yahoo.com
Tue Sep 25 07:25:02 PDT 2012
On Tue, 25 Sep 2012 07:53:17 -0400, Manu <turkeyman at gmail.com> wrote:
> So I have this recurring pattern, it's really starting to annoy me.
> It stems from the fact that a function prototype and the definition can
> not
> appear in the same file in D (as it can in C/C++)
Doing this is not illegal.
> Eg,
>
> void func(int x); // <-- declaration of function, informs type and
> associated names, args, ...
>
> //later
> void func(int x) // <-- may be generated with magic (and may use the
> prototype declaration for type information as declared by the prototype
> above)
> {
> ... do stuff
> }
This compiles. Do you have a better case to show the problem?
-Steve
More information about the Digitalmars-d
mailing list