Skip to content

warning: converting the enum constant to a boolean (SC_KEY_TAGACTION) #186

@stbuehler

Description

@stbuehler

Hi,

on my own branch (with a couple more fixes) there is one warning remaining that I don't know how to fix:

../src/ui.c:3755:29: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
     (keytagactive == FALSE && SC_KEY_TAGACTION)) && ic != -1) {

apt-dater/src/ui.c

Lines 3754 to 3760 in 113ea9b

if(((keytagactive == TRUE && sc != SC_KEY_TAGACTION) ||
(keytagactive == FALSE && SC_KEY_TAGACTION)) && ic != -1) {
keytagactive = FALSE;
refscr = TRUE;
curs_set(0);
remln(COLS);
}

Now the enum constant isn't zero (afaict), so should evaluate to true, and one could simply remove && SC_KEY_TAGACTION to remove the warning and keep the current semantic, but that probably wasn't the intention.

Other options probably are sc == SC_KEY_TAGACTION or sc != SC_KEY_TAGACTION (but the latter would reduce the whole condition to sc != SC_KEY_TAGACTION && ic != -1, ignoring keytagactive).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions