Skip to content

gtypes: Define signed integer minimum values in terms of maximum values

Philip Withnall requested to merge pwithnall/glib:1663-minint32-cxx-win32 into master

This is what limits.h does. It avoids a problem when compiling with MSVC (in C++ mode) on Windows, whereby the 0x80000000 constant is interpreted as unsigned, and then the unary minus is applied to it.

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4146?view=vs-2017

Add a test which should hopefully catch problems with different compilers’ interpretations of this in future.

Signed-off-by: Philip Withnall withnall@endlessm.com

#1663 (closed)

Closes #1663 (closed)

Merge request reports