December 2021
Intermediate to advanced
352 pages
9h 32m
English
Constants are great. Types are great. Constants of a specific type are really great. This is why class enums are just fantastic.
Historically, and we hope you no longer feel the need to do this, constants were defined as preprocessor macros. You might have seen something like this in a geometry-related source file:
#define PI 3.1415926535897932385
If you were unfortunate, in another file you might have seen something like this:
#define PI 3.1415926 // fine for float, insufficient for double
Or this:
#define PI 3.1415926535987932385 // mis-transcribed
Or this:
Read now
Unlock full access