avok23 @ Mon May 05, 2008 8:48 pm wrote:
i just wonder why any one would do that. What kind of function would require that?
There has been two pages of discussion in this thread on that topic.
I personally don't see this as too much of a failing of C++. The situations that have been presented where this would be useful seem contrived and work fine with a sentinel value.
More importantly, if the programmer supplies default argument, I don't see why it is necessary to go around their back and have the function act differently than if they just let the function provide the same value.
If I see a function with the signature void foo (int bar = 0); I expect it to work the same whenever it is provided with a 0, no matter where the 0 comes from.