I can define the constant as a float or 32-bit uint:
const float SecondsPerMinute = 60.0F;
or
const uint32 SecondsPerMinute = 60U;
The constant is used in some equations that expect int and some equations that expect float. I want my compiler and static analysis tools to be happy, so if necessary, statically scan it into the appropriate type.
Is it better to define a constant as a float and distinguish it from an int, or to define it as an int and discard it in a float? Does it matter, or does it depend more on personal opinion?
Let's say a constant is used an equal number of times, as an int and as a float.
source
share