`int32_t` in ESP v5.0 vs v4.4.2
Posted: Thu Dec 22, 2022 5:28 pm
When I was using v4.4.2 ESP-IDF with whatever version of the gcc compiler it installs by default, I was using a `%d` specifier to print `int32_t`. If I used `%ld` it would give me a warning. When I updated to v5.0, which also uses a later version of the C compiler, the opposite occurred: an `int32_t` expected a `%ld` specifier (which I reckon is what I'd really expect) and will warn if `%d` is used.
This isn't a problem, but I'm surprised that this interpretation of `int32_t` changed. I know some compilers on some architectures would consider a 32-bit integer as a long, and some would consider a 64-bit as a long. But obviously my architecture hasn't changed. So the newer version of the compiler seems to consider `uint32_t` as a long on ESP32, whereas the older version did not. Has anyone else seen this? I'm curious as to why it is different.
This isn't a problem, but I'm surprised that this interpretation of `int32_t` changed. I know some compilers on some architectures would consider a 32-bit integer as a long, and some would consider a 64-bit as a long. But obviously my architecture hasn't changed. So the newer version of the compiler seems to consider `uint32_t` as a long on ESP32, whereas the older version did not. Has anyone else seen this? I'm curious as to why it is different.