Why do you think that believing that sizeof(int) == 4 is worse than believing that int32_t exists? It doesn't have to
Conversely, incorrect assumptions about size/size/capacity can lead to subtle run-time bugs.
Or just use int32_t and let the compiler fail if your Toolchain does not have that. Then just write an appropriate header to add it (with the correct checks) ;)