<div style="white-space:pre-wrap">In my current implementation, it's up to the format provider.  If you have an illegal format spec (eg {0;0}) it ignores it and prints the format spec as a literal.  We could also add an assert here in theory.<br><br>If/when we move to c++14, a constexpr StringRef implementation would allow us to parse and validate the entire format string at compile time.<br><br>Since conciseness is one of the main goals of a library such as this, I would hate to actively hamper this for more compile time checking.  If you write an invalid format spec presumably your test will fail since it will ignore it</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 12, 2016 at 2:34 AM Pavel Labath <<a href="mailto:labath@google.com">labath@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12 October 2016 at 05:26, Zachary Turner via llvm-dev<br class="gmail_msg">
<<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br class="gmail_msg">
> os << format_string("Start: {0}, End: {1}, Elapsed: {2:ms}", start, end,<br class="gmail_msg">
> start-end);<br class="gmail_msg">
<br class="gmail_msg">
What would happen if I accidentally type "ps" instead of "ms" (I am<br class="gmail_msg">
assuming we will not support picoseconds here)?<br class="gmail_msg">
<br class="gmail_msg">
Will this abort at runtime?<br class="gmail_msg">
<br class="gmail_msg">
I would prefer if *all* arguments to the format were checkable at compile time:<br class="gmail_msg">
I.e. something like:<br class="gmail_msg">
os << "blah blah" << format<std::milli>(end-start) << "blah blah";<br class="gmail_msg">
<br class="gmail_msg">
I understand this may clash a bit with the desire for a compact<br class="gmail_msg">
representation, but maybe with some clever design we could achieve<br class="gmail_msg">
both?<br class="gmail_msg">
<br class="gmail_msg">
pl<br class="gmail_msg">
</blockquote></div>