Should i use int32, or i can use int? for crossplatform

I know that earlier, C++ type “int” for 64 bit platforms was different for Windows and Linux.
What about now?
Should i use only “int32”, “uint32” if i want strict 32 bit int?
or i can use just “int” “unsigned int”?

For example in C#, type “int” is always 32 bit, can i rely that C++ “int” is always 32 bit for modern compilers?

UE4 uses int32 everywhere, so ofc my preanswer is “yes”, i must use int32 always. But i am so used to “int” ;(

1 Like

Ok lets use “int32”, not “int”.

1 Like

is this the truth? i hope so

Check the Portable C++ code section of the coding standard for type information.

“Use of C++'s int and unsigned int types whose size may vary across platforms is acceptable in code where the integer width is unimportant. Explicitly-sized types must still be used in serialized or replicated formats.”

4 Likes