Boost logo

Boost :

From: Karl Nelson (kenelson_at_[hidden])
Date: 2002-02-19 11:59:27


> "Stewart, Robert" <stewart_at_[hidden]> writes:
>
> |> From: Peter Dimov [mailto:pdimov_at_[hidden]]
> |> > Sent: Monday, February 11, 2002 12:03 PM
> |> > From: "Karl Nelson" <kenelson_at_[hidden]>
> |> > > Second, what is reasonable here? Under Microsoft .Net they
> |> > > allow the same argument to be used multiple times. Or an
> |> > > argument not to be used. Should this be valid?
>
> |> > > cout << format("%2$d %2$x", i, i);
>
> |> > Why not?
>
> |> It allows a class of errors -- accidentally referring to the second
> |> argument both times, instead of both -- that it may be better to
> |> prevent.
>
> Correct. I misread the statement in my previous response. I thought
> that he was asking if we should allow passing the same argument (in this
> case, i) several times.
>
> IMHO, the stricter the rules concerning the format, the better, because
> it increases the probability of catching an error by the translator.

Okay that sounds like a reasonable argument. If you want the
argument twice then place it in twice.

   cout << format("foo %1% %2%", i, i);

--Karl


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