[dev] newbie question

From: Adam Kandur <rndd_AT_tuta.io>
Date: Wed, 28 Oct 2020 11:44:35 +0100 (CET)

hi everyone, i'm new in c programming. i tried to read sources but stuck with enum.
as i know, enum is mainly used to assign names to integral constants. but i don't understand, for example, this code
----------------------------------------------
enum term_mode {
    MODE_WRAP        = 1 << 0,
    MODE_INSERT      = 1 << 1,
    MODE_ALTSCREEN   = 1 << 2,
    MODE_CRLF        = 1 << 3,
    MODE_ECHO        = 1 << 4,
    MODE_PRINT       = 1 << 5,
    MODE_UTF8        = 1 << 6,
};
----------------------------------------------why not simply write ?
----------------------------------------------
enum term_mode {
    MODE_WRAP        = 1,
    MODE_INSERT      = 2,
    MODE_ALTSCREEN   = 4,
    MODE_CRLF        = 8,
    MODE_ECHO        = 16,
    MODE_PRINT       = 32,
    MODE_UTF8        = 64,
};
----------------------------------------------
Received on Wed Oct 28 2020 - 11:44:35 CET

This archive was generated by hypermail 2.3.0 : Wed Oct 28 2020 - 11:48:09 CET