Skip to content

Default will never be printed for flag_bool with def=false #14

Description

@ej-uses-git

I was copying over the library and renaming some things and came acorss the following lines in flag.h:

if (flag->def.as_bool) {
    fprintf(stream, "        Default: %s\n", flag->def.as_bool ? "true" : "false");
}

As you can see, the ternary operator there will always result in "true", since we just checked that it's non-zero in the if above it...

Maybe instead we can just always print the default for booleans?

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions