secp256k1 icon indicating copy to clipboard operation
secp256k1 copied to clipboard

ULL constants are not C89

Open real-or-random opened this issue 4 years ago • 1 comments

The README states as a goal: "Intended to be portable to any system with a C89 compiler and uint64_t support."

The C89 syntax does not specify unsigned long long (ULL) constants because there is no requirement that a unsigned long long type exists. We use ULL in a few places, e.g.: https://github.com/bitcoin-core/secp256k1/blob/39198a03eaa33d5902b16d3aefa7c441232f60fb/src/scalar_4x64_impl.h#L11

We should replace ULL with the UINT64_C macro from in stdint.h. Note that UL is not an issue: It's in the C89 syntax and unsigned long is guaranteed to have at least 32 value bits, so we can use it for uint32_t constants. We may still want to change it for consistency and readability (clearer expression of intent).

Alternatively, we can do nothing (because noone seemed to care about this so far).

real-or-random avatar Apr 20 '20 17:04 real-or-random

long long is specified in C99, so possible fix would be just to replace C89 with C99 in the readme

prusnak avatar Jan 19 '21 15:01 prusnak