Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-02-07 16:41:58


----- Original Message -----
From: "Kevin Cline" <kcline_at_[hidden]>
> Andrei Alexandrescu writes:
> > > I'm a big fan of having named (or keyword) parameters in the
language.<
> >
> > Me too. Unfortunately it's late to introduce named parameters in C++
now,
> > because it's very liberal with the names you give to formal parameters
in
> > declarations...
>
> I'm curious why we couldn't use => (or <-) to separate parameter names
> and values.

No, what I meant was what I noticed Peter also said: C++ basically ignores
the formal parameter names:

void f(int a, int b, int c);
void f(int b, int c, in a);
void f(int c, int a, int b);

is a legal program. Now how do you match names to parameters?

> > The only reasonable way now is to come with a keyword to substitute for
> > non-trailing default parameters. The obvious candidate is "default"; I
would
> > prefer a symbol (such as "?", "!") because "default" is quite a long
word.
>
> Why can't we just leave the default parameters out?
>
> f(a,,3)

Bjarne makes an explanation in "Design and Evolution of C++": too easy to
read it the wrong way. I agree with that explanation. So you need to have a
symbol in between the commas.

Andrei

---------------------------------
Check out THE C++ Seminar: 3 Days with 5 Experts
http://www.gotw.ca/cpp_seminar/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk