Hello Robert,

BCS wrote:

Theory 1: it's a side effect of two features:

this is allowed

int myFunc(int)  // I never use the arg so why name it?
{
}
and this is allowed

int myFunc(int i = 5)  // normal defaulting
{
}
so to avoid corner cases they are allowed in combination

theory 2:

it gives a function (with an anon arg, see above) that can be called
like this:

myfun(5);

and like this:

myfun();

To elaborate, this would be useful for extern functions, i.e.

extern(C) int myFunc(int = 5);
myFunc();  // Calls myFunc(5);
myFunc(6);

Ah, and yet another use. I think that is an even better theory than either of mine.


Reply via email to