rbmj/612-code — comment on commit 03988c8c635ddaa4898298711319b30ff19dba42
File: joysmooth.cpp line 6
By rbmj:

Yes we do. Those will work, but they are technically not correct. With integral types, and only integral types, you are allowed to declare and define the constant in a header file. However, you still need to also declare it in a source file. Why? Because the compiler needs to know what translation unit the constant is defined in. If you called &joysmooth::HOLDBACK (legal, though I don't know why you would do it), the linker would not know where the space was allocated (in what translation unit) for joysmooth::HOLDBACK, so it would give a linker error. By providing this definition we allocate the physical memory to hold the constants if they are needed. Modern compilers will also optimize this memory out if it is unneeded with link time optimization (llvm is great at this).