Boost C++ Libraries: Ticket #7255: lexical_cast is broken on MSVC .NET 2003 https://svn.boost.org/trac10/ticket/7255 <p> I could not find any hint in the release note that boost 1.51 does no longer support Visual Studio .NET 2003. Hence, I consider the following a (minor) bug. However it causes our project to fail the build on this platform, first time for a reason that I don't consider as "no way out". </p> <p> author's assumed intention: In boost 1.51 in file boost/lexical_cast.hpp in line 1353 and 1366, 1380 the Microsoft secure crt version sprintf_s of sprintf is called. This call is compiled under the condition that _MSC_VER is defined (with any value!). </p> <p> presumably unconsidered, severe problem: Please note, that the Microsoft secure crt was introduced with Visual Studio 2005. Visual Studio .NET 2003 does already have _MSC_VER defined. So, the conditional preprocessor instruction "#if(defined _MSC_VER)" imho is ill placed here. </p> <p> suggestion: I'd like to suggest to consider the numerical values of _MSC_VER here. If _MSC_VER is smaller than 1400 then Visual Studio version is before 8.0 or VS 2005 respectively. Hence I'd appreciate boost code to use a little more complex preprocessor conditional than befor, namely something like </p> <p> #if _MSC_VER &gt;= 1400 </p> <blockquote> <p> do it the MS Secure CRT Way </p> </blockquote> <p> #else </p> <blockquote> <p> ISO C++ </p> </blockquote> <p> #endif </p> <p> best regards </p> <blockquote> <p> Manfred </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7255 Trac 1.4.3 Manfred <kuhnkies@…> Tue, 21 Aug 2012 12:23:27 GMT summary changed https://svn.boost.org/trac10/ticket/7255#comment:1 https://svn.boost.org/trac10/ticket/7255#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">lexical_cast ist broken on MSVC .NET 2003</span> → <span class="trac-field-new">lexical_cast is broken on MSVC .NET 2003</span> </li> </ul> <p> to be more precise: my local patch, that fixes the compile error on MSVC 2003, looks like this: </p> <blockquote> <p> #if (defined _MSC_VER &amp;&amp; _MSC_VER &gt;= 1400) </p> </blockquote> Ticket Antony Polukhin Sat, 25 Aug 2012 08:06:12 GMT keywords, status, milestone changed https://svn.boost.org/trac10/ticket/7255#comment:2 https://svn.boost.org/trac10/ticket/7255#comment:2 <ul> <li><strong>keywords</strong> sprintf_s added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> Ticket Antony Polukhin Sat, 25 Aug 2012 19:07:49 GMT <link>https://svn.boost.org/trac10/ticket/7255#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7255#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80210" title="Fix compilation of lexical cast with MSVC 2003 (refs #7255)">[80210]</a>) Fix compilation of lexical cast with MSVC 2003 (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7255" title="#7255: Bugs: lexical_cast is broken on MSVC .NET 2003 (closed: fixed)">#7255</a>) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Wed, 05 Sep 2012 18:23:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7255#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7255#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80409" title="Merge from trunk: 1) #warning replaced with #error (refs #7228) 2) ...">[80409]</a>) Merge from trunk: 1) #warning replaced with #error (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7228" title="#7228: Bugs: Bugs: #warning in lexical_cast.hpp causes MSVC compile error (closed: fixed)">#7228</a>) 2) Pavel Korzh added to thanks list (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7157" title="#7157: Bugs: [lexical_cast] convert volatile int to string cause Run-Time Check ... (closed: fixed)">#7157</a>) 3) BOOST_NOEXCEPT modifiers added where possible 4) better support for c++11 Unicode characters 5) fixed compilation with MSVC+STLPort 6) more agressive usage of Traits template parameter 7) Added lexical_cast(const <a class="missing wiki">CharType</a>* chars, std::size_t count) function overload (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6430" title="#6430: Feature Requests: Optimized code for `boost::iterator_range&lt;std::string::iterator&gt;` (closed: wontfix)">#6430</a> and refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6663" title="#6663: Feature Requests: Avoiding input copying (closed: fixed)">#6663</a>) 8) Fixed GCC warning in numeric_cast_test.cpp 9) Fix compilation of lexical cast with MSVC 2003 (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7255" title="#7255: Bugs: lexical_cast is broken on MSVC .NET 2003 (closed: fixed)">#7255</a>) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Sat, 15 Sep 2012 07:30:39 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7255#comment:5 https://svn.boost.org/trac10/ticket/7255#comment:5 <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">fixed</span> </li> </ul> Ticket