On 2015-09-05 17:09, Stefan Behnel wrote:
It now appends the 'U' suffix only to literals that are used in an unsigned context (e.g. assignment to unsigned variable), and additionally appends L/LL suffixes for integers that might exceed the int/long limits.
Why not just keep it simple, append no suffixes and let the C/C++ compiler deal with it? No heuristics needed. More concretely, I would handle this as follows: * do not use any L or U suffix * write all DEF constants as hexadecimal in the source code This way, the C/C++ compiler will determine the integral type. It will use the first type in the following list which can represent the number: - int - unsigned int - long - unsigned long - long long - unsigned long long The reason for the *hexadecimal* constants is that the unsigned types are not tried for decimal constants.