Boost C++ Libraries: Ticket #6815: Compile time checking of format string (e.g. in printf) https://svn.boost.org/trac10/ticket/6815 <p> It would be great to have possibility to check correspondence and correctness of format and arguments of printf function in compile time. This functionality would fill in the lack of expressive power of user-defined literals form C++11, I mean inability to use template-user-defined literal for character strings (e.g. "qwerty 123"_format). In attachment you can find my implementation of it. It would be really great if it or maybe better improved variant of it will be in boost. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6815 Trac 1.4.3 d.starosud@… Sat, 21 Apr 2012 15:51:12 GMT attachment set https://svn.boost.org/trac10/ticket/6815 https://svn.boost.org/trac10/ticket/6815 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">templ_literal.h</span> </li> </ul> Ticket d Sat, 21 Apr 2012 15:51:32 GMT attachment set https://svn.boost.org/trac10/ticket/6815 https://svn.boost.org/trac10/ticket/6815 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> Ticket d. Sat, 21 Apr 2012 15:51:35 GMT attachment set https://svn.boost.org/trac10/ticket/6815 https://svn.boost.org/trac10/ticket/6815 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.2.cpp</span> </li> </ul> Ticket d.starosud@… Sat, 21 Apr 2012 15:53:39 GMT <link>https://svn.boost.org/trac10/ticket/6815#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6815#comment:1</guid> <description> <p> Sorry, I added two similar files. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 05 Dec 2013 12:16:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6815#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6815#comment:2</guid> <description> <p> Awesome! I've been looking for something like this for years </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 23 Mar 2015 07:06:25 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/6815 https://svn.boost.org/trac10/ticket/6815 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">printf.cpp</span> </li> </ul> <p> additional format type checking </p> Ticket James E. King, III Wed, 18 Oct 2017 18:36:17 GMT owner, status changed https://svn.boost.org/trac10/ticket/6815#comment:3 https://svn.boost.org/trac10/ticket/6815#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Samuel Krempp</span> to <span class="trac-author">James E. King, III</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket James E. King, III Wed, 18 Oct 2017 18:53:11 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6815#comment:4 https://svn.boost.org/trac10/ticket/6815#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> This implementation is incomplete so I am going to mark it as wontfix. Seems like a cool idea but it wouldn't support dynamically generated format specifications and doesn't support the complete syntax of boost format... unit tests should be used in consuming code to ensure no exceptions occur. </p> <p> An interesting place to make a change like this could be in the gcc/clang static analyzers... if you build with "-Wformat" they can stop a build on a static format string that is malformed or when the wrong sized argument is given for a conversion specifier. Perhaps adding support for boost::format to that would be useful, but it still wouldn't take care of dynamically generated format specifications. </p> Ticket