Ways to ASSERT expressions at build time in C
问题 I'm tidying up some older code that uses 'magic numbers' all over the place to set hardware registers, and I would like to use constants instead of these numbers to make the code somewhat more expressive (in fact they will map to the names/values used to document the registers). However, I'm concerned that with the volume of changes I might break the magic numbers. Here is a simplified example (the register set is more complex): const short mode0 = 0; const short mode1 = 1; const short mode2