#Min/#Max Constants different on Windows and Linux

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
uwekel
Enthusiast
Enthusiast
Posts: 740
Joined: Sat Dec 03, 2011 5:54 pm
Location: Oldenburg (Germany)

#Min/#Max Constants different on Windows and Linux

Post 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
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

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

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Demivec
Addict
Addict
Posts: 4261
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

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

Post 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).
Post Reply