Boost logo

Boost :

From: Moore, Paul (paul.moore_at_[hidden])
Date: 2001-07-02 04:05:49


-----Original Message-----
From: Beman Dawes <bdawes_at_[hidden]>
> At 10:08 PM 6/30/2001, Greg Chicares wrote:
>
> >Aleksey Gurtovoy wrote:
> >>
> >> My main problem with '%' is that it's not an idiomatic C++, at
> >> least not yet :). Also, using of '$' in format specification,
> >> but '%' when providing arguments seems inconsistent.
> >
> >Is it a (different) problem that dollar-sign is not part
> >of the language's basic source character set (2.2/1) ?
> >If that character is unavailable on, say, an Icelandic
> >keyboard, then there's no trigraph for it either.
>
> Ouch! Good catch, Greg.
>
> > Would
> >a library that needs dollar-sign be acceptable in ISO C++?
>
> I doubt it.
>
> IMO, we need to stick to the basic character set.

Given that there is a "common practice" extension of C's printf to support $
for positional arguments (as in the "%2$s" form), which is currently
included (and which I'd like to see stay), it's not clear what the best way
of addressing this might be. Pick an alternative character? "#" - for
"number" (ie, argument number) might do, but does it clash with other usage?
How does that square with the incompatibility with existing practice?

On a separate note, I like the % form.

But I do thing there's a need for a cleaner "convert to string" operation.
At the very least, a non-member str() function seems notationally cleaner -

    str(format("%.20s") % my_string)

As an alternative (not a particularly good one, IMHO...) would be some form
of magic "convert to string" manipulator - something like

    format("%.20s") % my_string % to_str

But the need for the extra brackets and dot notation in

    (format(%.20s") % my_string).str()

make it look irredeemably ugly to me.

Paul.


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