Anonymous enums are in common use for defining compile-time-only constants in a compiler-supported fashion (i.e. without resorting to Macros), in C. This is also true for C++ (because even while the use of constexpr
is somewhat of an alternative, one can still take the address of a constexpr
constant and force it to actually have one at run time).
Now, it seems that in C++20, arithmetic between different enum types has been deprecated, it seems. But – I want to use arithmetic between my named constants, e.g.
enum {BlockSize = /* whatever */; }
enum {Padding = /* whatever */; }
// ...
auto my_addr = base_addr + (BlockSize + Padding) * 10
but this gives me a deprecation warning. Now, I suppose I can just suppress that, but – what (if any) would be the appropriate change-of-idiom for this code.