cstdint correct use
-
I can't figure out the right use.
cstdint
♪ Like writing a type.uint32_t
And I'm looking at his size in the programming of logic, then I'm on a platform whereint > 32
and mine.uint32_t
processing slowly. Okay, just use it.int
which is always equal to the right value. If I move to another platform whereint < 32
the logic of my program will be hurt.Maybe then we need to program the logic on the smallest.
int
and fix valuesuint_leastN_t/unit_fastN_t
? Or sacrifice productivity?And
uint_leastN_t/unit_fastN_t
- What are they different?
-
Types without reference
fast
orleast
Use exact size in battle. However, some architects of these types may not be present at all. As stated in Standard 18.4.1:namespace std { typedef signed integer type int8_t; // optional ... }
Therefore, the code has to be used, or
fast
orleast
A version. To achieve maximum speed or minimum memory flow, respectively. Such types are already mandatory in the Standard (no word available)optional
)