inline enum in function declaration
Deewiant
deewiant.doesnotlike.spam at gmail.com
Mon Jun 12 05:35:31 PDT 2006
Lionello Lunesu wrote:
> I'm cutting back on the use of "bool" as a function parameter, since the
> words "true" and "false" are rarely applicable to the respective
> parameter, for example:
>
> #void Invalidate( bool redraw );
>
> This declaration seems ok, but when reading the code:
>
> #Invalidate(true);
>
> you have no idea what that "true" is referring to. I guess everybody
> knows what I'm talking about with "cutting back on the bool".
>
> Obviously "enum" is the right replacement:
I'd prefer just being able to pass the names of function parameters when calling:
Invalidate(redraw : true);
There were probably some reasons why this isn't that simple (syntax ambiguities
or non-consensus), but I'm too lazy to look them up. I'm fairly sure this has
been discussed before, though.
More information about the Digitalmars-d
mailing list