Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2002-02-11 15:17:39


It seems that Boost participants have two kinds of desires for a formatting
library.

    A) Those who work in a world where printf format strings are a standard
are looking for a way to use printf format strings in type safe C++ code. I
think that a mechanism compatible with printf that does not have any
significant extensions would be highly valuable.

    B) Others are trying to define a new format language that can be used
instead of the printf format strings.

I think that both of these things would be valuable. But I think that
defining a new language is quite difficult. So I think we should do A first.
It's also clear that the best syntax for A would be the same as C printf
syntax:

    format("%s %d", str, i);

There's no need to get into operator overloading, with one small exception.
To avoid having a fixed size limit on the number of parameters, we need some
kind of way to provide additional parameters. I think that either the
"operator ()" or the ".with()" proposal would be fine.

I don't think that the desire for a new formatting language should prevent
us from creating a typesafe implementation of printf. The use of this for
porting code from C alone would seem to justify it, let alone the other
arguments (programmers familiar with it, format language already defined in
standards, etc.).

    -- Darin


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