Private default function arguments

bearophile bearophileHUGS at lycos.com
Fri Jan 15 04:13:05 PST 2010


Daniel Murphy:
> private struct privateint { int i; alias i this; };
> void foo(int x, privateint y = privateint(0))
> {
>     ...
> }
> 
> It's ugly, but should give reasonable error messages.

It looks like giving error messages if it's located in another module. And I agree, it's ugly. In real code for this problem I'll keep using the first solution, that is rely on convention and code comments (the static nested function approach too is too much hairy).

Bye,
bearophile



More information about the Digitalmars-d mailing list