Commit 3768362a authored by Guilherme Maciel Ferreira's avatar Guilherme Maciel Ferreira
Browse files

Increase LOG_LEVELS enum type safety



Use enum LOG_LEVELS instead of int for log and trace levels.

According to ISO/IEC 9899:2011, section 6.7.2.2
(Enumeration specifiers), paragraph 4: "Each enumerated type
shall be compatible with char, a signed integer type, or an
unsigned integer type. The choice of type is implementation-
defined, but shall be capable of representing the values of
all the members". Section J.3.9 also exposes the implementation
defined nature of enumeration signess.

A negative value (-1) is assigned to objects of type enum
LOG_LEVELS. However, the enumeration type might be implemented
as unsigned integer, because there are only positive enumerators
(enumeration members). Thus, this may cause signess mismatches on
some architectures.

Signed-off-by: default avatarGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
parent 19bfd099
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment