D - Default Values
- Scott Egan (20/20) Apr 14 2004 I was looking at some example code and noticed that the author had used
- Dave Sieber (7/11) Apr 14 2004 Personally, I like the C++ way of doing it (probably through familiarity...
I was looking at some example code and noticed that the author had used
extra versions of overloaded functions to achieve what amounted to default
values.
eg
foo(int a, int b)
{
foo(a, b, 5)
}
foo(int a, int b, int c)
{
....
}
were if default values were supported:
foo(int a, int b, int c = 5)
{
....
}
would do the trick. I appreciate that the compiler may be able to reduce
both to almost the same thing, but....
thoughts?
Apr 14 2004
"Scott Egan" <scotte tpg.com.aux> wrote:I was looking at some example code and noticed that the author had used extra versions of overloaded functions to achieve what amounted to default values.thoughts?Personally, I like the C++ way of doing it (probably through familiarity over the years), as it seems simple, useful, and less verbose than writing a set of extra functions. But I think Walter may not like it for D. This has been discussed a lot recently. -- dave
Apr 14 2004








Dave Sieber <dsieber spamnot.sbcglobal.net>