Different MAX int32?

Hello, I was going to use the maximum amount for an int32 instead of typing a large number and I found multiple maximum int32 macros. I wanted to ask if there is a difference between them or is there a specific one that Epic recommends to use (and hopefully why)? I listed the max int32’s that I found and what each one has in its () but this is kinda the same for any of the other max int values. I appreciate any answers on this :slight_smile:

-MAX_int32 ((int32) 0x7fffffff)

-MAXINT32 ((INT32)(MAXUINT32 >> 1))

-INT32_MAX (2147483647i32) This one didn’t have it in () but thats what showed up as the description

-INT_FAST32_MAX (INT32_MAX)
This had the same case as above and is pretty much just using that macro instead…

The first macro should be the best as it part of UE4 math library and it most directly define maximum value, but… this macros is used for something else which is TNumericLimits:

https://github.com/EpicGames/UnrealEngine/blob/1d2c1e48bf49836a4fee1465be87ab3f27d5ae3a/Engine/Source/Runtime/Core/Public/Math/NumericLimits.h

So you should use those insted, because if there something UE4 APIs then enigne and Epic expect you using it, it gives you guaranty that if there be any changes your code won’t feel it or at least you gonna be informed if change gonna happen by compiler warning if you updating UE4 regularly.

1 Like