Skip to main content

integer_text

Function integer_text 

Source
pub fn integer_text(value: i128) -> String
Expand description

An integer as the source text of a C constant expression.

Every value but one is its own decimal. −2^63 is not a literal in C at all: C99 6.4.4.1 has no negative integer constant, so -9223372036854775808 is a unary minus over the decimal constant 9223372036854775808, and that constant fits no signed type in the list 6.4.4.1 gives it — the implementation may give it an extended unsigned type, and the negation that follows is then an implementation-defined conversion rather than the value the source wrote. Wrapping it in INT64_C(..) changes nothing: C99 7.18.4.1 makes that macro paste a suffix onto the token it is handed, so the same too-large constant is what the minus applies to. Measured, gcc 16.1.0 answers “integer constant is so large that it is unsigned” and Apple clang 21.0.0 -Wimplicitly-unsigned-literal.

The subtraction <stdint.h> itself writes INT64_MIN as is exact and has no such constant in it. crates/wire-probe/src/fill.rs, fill_ros.rs and fill_cpp.rs already spell the value this way.