Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-02-09 11:00:08

----- Original Message -----
From: "James Kanze" <kanze_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, February 09, 2002 8:44 AM
Subject: Re: [boost] Preminary submission: format3

> "Rainer Deyke" <root_at_[hidden]> writes:
> |> - The following should silently swallow the "foo" argument:
> |> cout << format("%2$s", "foo", "bar");
> |> Right now, it invokes undefined behavior.
> Why not an exception? (My own implementation treats the presence of
> %2$ without a %1$ as an error.) Of course, he did say X/Open
> compatibility, and in X/Open printf, it is undefined behavior:-).

Because it is sometimes useful to exclude some arguments from the
resulting string (or to include the same argument several times).

char const *strings[] = {
  "There are %1$s objects of type %2$s.",
  "There are %1$s %3$s."};

format(strings[n], 5, "apple", "apples");

Rainer Deyke | root_at_[hidden] |

Boost list run by bdawes at, gregod at, cpdaniel at, john at