Modify

Ticket #7255 (closed Bugs: fixed)

Opened 20 months ago

Last modified 19 months ago

lexical_cast is broken on MSVC .NET 2003

Reported by: Manfred <kuhnkies@…> Owned by: apolukhin
Milestone: Boost 1.52.0 Component: lexical_cast
Version: Boost 1.51.0 Severity: Showstopper
Keywords: MS Secure CRT sprintf_s Cc:

Description

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".

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!).

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.

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

#if _MSC_VER >= 1400

do it the MS Secure CRT Way

#else

ISO C++

#endif

best regards

Manfred

Attachments

Change History

comment:1 Changed 20 months ago by Manfred <kuhnkies@…>

  • Summary changed from lexical_cast ist broken on MSVC .NET 2003 to lexical_cast is broken on MSVC .NET 2003

to be more precise: my local patch, that fixes the compile error on MSVC 2003, looks like this:

#if (defined _MSC_VER && _MSC_VER >= 1400)

comment:2 Changed 20 months ago by apolukhin

  • Keywords sprintf_s added
  • Status changed from new to assigned
  • Milestone changed from To Be Determined to Boost 1.52.0

comment:3 Changed 20 months ago by apolukhin

(In [80210]) Fix compilation of lexical cast with MSVC 2003 (refs #7255)

comment:4 Changed 20 months ago by apolukhin

(In [80409]) Merge from trunk: 1) #warning replaced with #error (refs #7228) 2) Pavel Korzh added to thanks list (refs #7157) 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 CharType?* chars, std::size_t count) function overload (refs #6430 and refs #6663) 8) Fixed GCC warning in numeric_cast_test.cpp 9) Fix compilation of lexical cast with MSVC 2003 (refs #7255)

comment:5 Changed 19 months ago by apolukhin

  • Status changed from assigned to closed
  • Resolution set to fixed
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.