Page 1 of 1

#Min/#Max Constants different on Windows and Linux

Posted: Mon Mar 25, 2013 8:02 pm
by uwekel
Hi,

today i wanted to use some #Min.../#Max... constants and found out that they are not defined equally on Windows and Linux. A few are defined on Windows, on Linux they are all missing. Some values have - from my opinion - wrong values.

Code: Select all

Constant  Expected Value       Windows     Linux Remark
--------- -------------------- ----------- ----- ------------------------
#MINBYTE  -128                 no          no
#MAXBYTE  127                  yes         no
#MINASCII 0                    no          no
#MAXASCII 255                  no          no
#MINWORD  -32768               no          no
#MAXWORD  32767  	           yes         no
#MINCHAR  0                    128?        no
#MAXCHAR  255                  127?        no    Unicode=65535
#MINLONG  -2147483648          2147483648? no    Windows=2147483648
#MAXLONG  2147483647           yes         no
#MININT   -2147483648          no          no    x64=-9223372036854775808
#MAXINT   2147483647           no          no    x64=9223372036854775807
#MINQUAD  -9223372036854775808 no          no
#MAXQUAD  9223372036854775807  no          no
#MINDATE  0                    no          no
#MAXDATE  2147483647           no          no
I would like to see unique values for all operating systems.

Best regards
Uwe

Re: #Min/#Max Constants different on Windows and Linux

Posted: Mon Mar 25, 2013 8:12 pm
by ts-soft
Only a hint: All constants without trailing #PB_ a API-Constants, the value comes from the header from API.
uwekel wrote:I would like to see unique values for all operating systems.
+ 1

Re: #Min/#Max Constants different on Windows and Linux

Posted: Tue Mar 26, 2013 5:21 am
by Demivec
uwekel wrote: Some values have - from my opinion - wrong values.
[snip]

Code: Select all

Constant  Expected Value       Windows     Linux Remark
--------- -------------------- ----------- ----- ------------------------
#MINLONG  -2147483648          2147483648? no    Windows=2147483648
In this case, you would be comparing a long to a long. If you are displaying the constant value using Debug then it will display as a positive number (a quad), which is incorrect since it represents a signed long value. Instead, assign it to a long and display that; the value displayed will be -2147483648.

Since these values are defined by the OS's API you need to refer to that for their correct use and what their size is (i.e. long, quad or whatever).