Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual studio 2015 update3 true != TRUE #317

Closed
alessiodallapiazza opened this issue Sep 25, 2016 · 4 comments
Closed

Visual studio 2015 update3 true != TRUE #317

alessiodallapiazza opened this issue Sep 25, 2016 · 4 comments
Labels
platform: visual studio related to MSVC solution: invalid the issue is not related to the library

Comments

@alessiodallapiazza
Copy link

alessiodallapiazza commented Sep 25, 2016

Good evening,
I was playing with this fantastic project and while using the function value for getting a result from a json file I met an exception.
The problem is that the visual studio TRUE is not used as the same true.
My JSON file:

{
    "ok": true
}

The error is when I use the value function with TRUE instead of true.

if (j.value("ok",false)) // WORKS

if (j.value("ok",FALSE)) // EXCEPTION

Some reference:
http://stackoverflow.com/questions/830067/when-should-bool-and-bool-be-used-in-c

@gregmarr
Copy link
Contributor

This is because FALSE is an integer type, and you're using it to ask for a boolean value. They're not compatible. When using the value function like that, you need to provide a default of a compatible type.

@alessiodallapiazza
Copy link
Author

Thank you, usually on windows I use the "windows" boolean.
It is just ugly on the code seen false and FALSE on the code.

@gregmarr
Copy link
Contributor

I agree, it's too bad that FALSE is the wrong type for this. Unfortunately, changing the type of FALSE would probably break too many things.

@alessiodallapiazza
Copy link
Author

Thank you for your support.

@nlohmann nlohmann added solution: invalid the issue is not related to the library platform: visual studio related to MSVC labels Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: visual studio related to MSVC solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

3 participants