Private default arguments?

bearophile bearophileHUGS at lycos.com
Fri Dec 28 07:14:53 PST 2012


monarch_dodra:

> What's wrong with:
>
> //----
> void radixSort(uint[] items)
> {
>      radixSortRecurse(items);
> }
>
>
> private void radixSortRecurse(uint[] items, in uint 
> shiftBits=24)
> {
>      ...
>      if (shiftBits > 0) {
>          ...
>          radixSortRecurse(array[...], shiftBits - 8);
>      }
> }

That's what I do in languages that don't allow nested functions, 
like ANSI C, etc. It's very similar to defining a static inner 
function in D. You end with two functions, two names, more code, 
etc.

Bye,
bearophile


More information about the Digitalmars-d mailing list