Function Prototypes in D?

Joscci jsantos.uno.ceen at gmail.com
Fri May 25 08:46:32 PDT 2007


Sean Kelly Wrote:

> 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

Gotcha.   Thanks for the clarification -- and for answering. :o)

- Joscci - 



More information about the Digitalmars-d mailing list