Function Prototypes in D?

Sean Kelly sean at f4.ca
Fri May 25 08:06:11 PDT 2007


Joscci wrote:
> Hello everyone,
> 
> I'm a newcomer to the D language (though not new to programming) and currently reading through the documentation to learn this fascinating new language.
> 
> In any case, I was wondering -- does D make use of function prototypes like in C/C++? or are function definitions all that is necessary in D?
> 
> I did tried experimenting with the compiler and it appears that the answer to my question is the latter, but wanted to make sure this is indeed the case.

You can use prototypes if the implementation for a function is compiled 
separately, but you can't prototype a function that is later defined, 
and you can't provide multiple prototypes for the same function, even if 
they match exactly.  I've found this last restriction to be somewhat 
frustrating at times, as I believe it even applies to private prototypes.


Sean



More information about the Digitalmars-d mailing list