bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

attribute set datatype


From: Ruslan Nabioullin
Subject: attribute set datatype
Date: Mon, 23 Dec 2013 12:09:38 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131104 Icedove/17.0.10

Hello,

What is the reason that the integral datatype used as an attribute set is signed in functions and macros consuming or returning the set? Obviously signedness is less elegant and leads to nonintuitive behavior when right-shifting.

Furthermore, why is the datatype different in attribute definitions (unsigned)? That essentially means that two different datatypes are used for the same intended datatype; although C is weakly-typed, compilers may emit a warning, such as in:

unsigned int msg_attributes;
...
msg_attributes = color_available &&
        init_pair(MSG_COLOR_PAIR, MSG_TEXT_COLOR, COLOR_BLACK) != ERR
        ? COLOR_PAIR(MSG_COLOR_PAIR) : A_NORMAL;
...

-Ruslan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]