-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
platform: visual studiorelated to MSVCrelated to MSVCsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
In the version 2.1.1, msvc generates a few warnings about std::numeric_limits<>::max() (and min) usage. This is because windows.h have their own min/max macros definitions in the global namespace (here is microsoft kb article about it..
warning exact text: warning C4003: not enough actual parameters for macro 'max'
possible fixes:
1)
#define NOMINMAX
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
- use additional parenthesis
std::numeric_limits<uint8_t>::max() => (std::numeric_limits<uint8_t>::max)()
First two methods can produce problems, due to use original windows min/max in the gdi and more.
the third method should be tested on the other compilers.
Source to reproduce the problem:
#include "stdafx.h"
#include "windows.h"
#include "json.hpp"
using json = nlohmann::json;
int main( int argc, char const *argv[] )
{
json j;
j[ "test" ] = 1;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
platform: visual studiorelated to MSVCrelated to MSVCsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation