Function prototype + definition in the same file
deadalnix
deadalnix at gmail.com
Tue Sep 25 12:22:37 PDT 2012
Le 25/09/2012 20:05, Jonathan M Davis a écrit :
> On Tuesday, September 25, 2012 19:51:42 deadalnix wrote:
>> Le 25/09/2012 18:38, Jonathan M Davis a écrit :
>>> On Tuesday, September 25, 2012 14:53:17 Manu wrote:
>>>> I really need this. Why is it illegal? Is there chance of having this
>>>> supported? What are the problems?
>>>
>>> I confess that I don't understand why you'd ever need function prototypes,
>>> so clearly one (or both) of us is missing something here.
>>
>> It can help IDE for instance. Or help the programmer when looking for
>> references in the source code.
>
> I don't understand this. The IDE can see what functions are there. How would
> having a function prototype affect that? It has to look for the real function
> regardless, since there's no guarantee that they all have prototypes. The same
> goes for the programmer. And if it's a matter of knowing what functions in a
> module are publicly available to use, then that's what generated documentation
> is for. The only languages that I know of which use prototypes are C and C++,
> and folks in other languages get by just fine without them. They only exist in
> C/C++ beacuse of its antiquated compilation model. Sure, they could be useful
> at times for documentation purposes, but it's code duplication which may or
> may not be up-to-date with the actual code, especially when the language is
> advanced enough that it doesn't need a function to be declared earlier in the
> file than where it's called. And generated documentation or an IDE solves the
> problem of getting a list of the functions if that's what you want.
>
> Regardless, Manu seems to have issues related to linking, which is a
> completely separate issue and that's what I don't understand.
>
> - Jonathan M Davis
I'm playing devil advocate here, I answered elsewhere that I would be
against such modification of the language.
More information about the Digitalmars-d
mailing list