[llvm-dev] RFC: General purpose type-safe formatting library

Tim Shen via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 12 13:01:32 PDT 2016


On Wed, Oct 12, 2016 at 12:35 PM Zachary Turner via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> You get compile time checking automatically when we can use c++14 though.
> If you use it with a string literal, you'll get compile time checking,
> otherwise you won't.
>

Even with C++14, os.format("literal format", a, b, c) cannot do the
compile-time checking (I maybe wrong with understanding C++14 constexpr).
You probably need to add a overloaded version like
`os.format(static_format("literal format"), a, b, c)`, or
`os.format("literal format"_fmt, a, b, c)` to hold the compile-time checked
version.

But anyway, the current interface os.format(const char*, ...) is
forward-compatible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161012/1dc0be25/attachment.html>


More information about the llvm-dev mailing list