[CXX-83] numeric_limits::max compilation problem on windows Created: 13/Feb/11  Updated: 04/May/14  Resolved: 16/Apr/14

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: legacy-0.8.0

Type: Bug Priority: Critical - P2
Reporter: Johannes Wienke Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: cxxmove, legacy-cxx, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows with MSVC 2008



 Description   

Compilation of client applications may break because of the in-header implementation of many methods, e.g. in bsonutils. There numeric_limits::max is used, which gives a compilation error because max is often defined as a macro which may be pulled in earlier by other headers. Even WinDef.h defines this macro. Please ensure that the mongodb code undefs any existing version of max before using numeric_limits::max. This error would be much easier to prevent if the methods weren't implemented in-header.



 Comments   
Comment by Githook User [ 16/Apr/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-83 Handle Windows pernicious NOMINMAX more gracefully
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/7b72521aa35c64fd0d92a7f6bf24dea1c7bac844

Comment by Andrew Morrow (Inactive) [ 16/Apr/14 ]

https://github.com/mongodb/mongo-cxx-driver/pull/54

Generated at Wed Feb 07 21:58:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.