Skip to content

Visual studio 2015 update3 true != TRUE #317

Closed

Description

@alessiodallapiazza

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

Activity

  1. gregmarr commented on Sep 26, 2016

    @gregmarr
    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.

  2. alessiodallapiazza commented on Sep 28, 2016

    @alessiodallapiazza
    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.

  3. gregmarr commented on Sep 28, 2016

    @gregmarr
    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.

  4. alessiodallapiazza commented on Sep 28, 2016

    @alessiodallapiazza
    Author

    Thank you for your support.

  5. added
    solution: invalid
    on Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: visual studiosolution: invalid

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions