|
Boost : |
From: manphiz (manphiz_at_[hidden])
Date: 2007-08-15 08:36:14
Douglas Gregor wrote:
> On Aug 15, 2007, at 3:19 AM, manphiz wrote:
>
>> Phil Endecott wrote:
>>> This stuff will all be much easier once we have variadic templates,
>>> i.e. you will be able to have a type-safe sprintf in C++. You can
>>> now
>>> get a version of gcc that supports them, and they should be in C++0x.
>>> So unless you have some very urgent reason to change immediately, I
>>> suggest that you wait for a bit.
>>>
>>> (I imagine that this means that the operator%-style Boost.Format will
>>> not progress towards the standard library, but I am not in any
>>> position
>>> to comment on that.)
>>>
>> Maybe the operator%-style can be obsolete (and I don't like it either)
>> in favor of variadic templates magic, but plain sprintf still
>> cannot be
>> directly used to deal with std::string, is it?
>
> Why not? Variadic templates make it possible to implement a sprintf-
> like interface that supports all data types (strings, user-defined
> types, etc.) and checks the format string against the actual argument
> types to provide better type safety. They give us a chance to revisit
> the Format interface to determine whether we can do better with new
> features; that might mean bringing back the old-but-familiar (s)
> printf interface with added functionality.
>
Thanks for enlightening me on this! It seems templates may make
printf-family something more ambitious. And following this lead, many
plain C functions may also be excavated and refined with new power as
well! I'm quite curious about where this is going.
On the other hand, I'm also a little bit doubt about whether this is
something that C++ will be interested in. C interfaces was introduced
into C++ intact to maintain compatibility, and it is likely to remain
that way.
So what's going to happen? Is there any discussion in this realm?
> - Doug
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk