Function prototype + definition in the same file

deadalnix deadalnix at gmail.com
Tue Sep 25 12:23:50 PDT 2012


Le 25/09/2012 20:57, Maxim Fomin a écrit :
> On Tuesday, 25 September 2012 at 17:48:46 UTC, deadalnix wrote:
>> This is code duplication and is generally considered as a bad
>> practice. I'm not convinced that the language should be modified to
>> allow something that is known as bad practice.
>>
>> What you need here is a more robust di generator IMO.
>
> This is neither a code duplication (there is certain distinction between
> prototype and body) nor a bad practice - this is a common pattern in C
> and C++. It is surprising that D cannot do such a simple thing which in
> addition is not harmless, so there is no sense in depreciating it.

This is code duplication. And this has been considered a problem in 
C/C++ for a while now.


More information about the Digitalmars-d mailing list