samedi 29 juillet 2017

Better constant definition approach

While exploring SQLite source code for learning purposes I found this in many places within the source code;

#define SQLITE_LOCK_NONE          0
#define SQLITE_LOCK_SHARED        1
#define SQLITE_LOCK_RESERVED      2
#define SQLITE_LOCK_PENDING       3
#define SQLITE_LOCK_EXCLUSIVE     4

#define SQLITE_IOCAP_ATOMIC                 0x00000001
#define SQLITE_IOCAP_ATOMIC512              0x00000002
#define SQLITE_IOCAP_ATOMIC1K               0x00000004
#define SQLITE_IOCAP_ATOMIC2K               0x00000008
#define SQLITE_IOCAP_ATOMIC4K               0x00000010

Is this standard in modern C++ (C++11, 14, 17) or are there different ways to do this in modern C++?

Aucun commentaire:

Enregistrer un commentaire