Private default arguments?

monarch_dodra monnarchdodra at gmail.com
Fri Dec 28 06:41:30 PST 2012


On Friday, 28 December 2012 at 14:10:01 UTC, bearophile wrote:
> [SNIP]
> bearophile

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);
      }
}
//----

I know I never write recursive functions with a public entry
point anyways: You *always* end up with "test only the first
time" or "countdown the number of iterations" or some other
problem that will force you onto this scheme sooner or later
anyways.

As mentioned, this also allows module level sharing.


More information about the Digitalmars-d mailing list