Page 1 of 1

PB constants for min-max limits according to variable type

Posted: Sat Jan 26, 2013 11:04 am
by Denis
For tests with Select it's not posible to write this for positive/negative value (or for another range)

Code: Select all

Select a.i 
case  >0 
case  < 0
case  >=0 
case  <= 0
like this it's Ok for x86, integer value

Code: Select all

Select a.i 
case   1  to  2147483647
case  -2147483648  to  -1
case  0  to  2147483647 
case  -2147483648  to  0
and for x64, integer value

Code: Select all

Select a.i 
case   1  to  9223372036854775807
case  -9223372036854775808  to  -1
case  0  to  9223372036854775807 
case  -9223372036854775808  to  0
1) will it be possible to have PB constants for min-max limits according to variable type?
By this way, it'll we done once for all (all plateforms, all coders).

2) it will be good to have case > etc. for Select test

since last of 2001 i use PB, it seems to me that i remember some of us already ask for that :mrgreen:

Re: PB constants for min-max limits according to variable ty

Posted: Sat Jan 26, 2013 6:16 pm
by STARGÅTE
2) it will be good to have case > etc. for Select test
No, Select:Case is no If:ElseIf.

Code: Select all

If a > 0
ElseIf a < 0
EndIf

Re: PB constants for min-max limits according to variable ty

Posted: Sat Jan 26, 2013 6:42 pm
by Denis
STARGÅTE wrote:
No, Select:Case is no If:ElseIf.

Code: Select all

If a > 0
ElseIf a < 0
EndIf
Yes, but it's not because if then else do the trip that select case does not have to do it

Re: PB constants for min-max limits according to variable ty

Posted: Sat Jan 26, 2013 7:03 pm
by STARGÅTE
Denis wrote:Yes, but it's not because if then else do the trip that select case does not have to do it
what?

btw:

Code: Select all

#PB_MinByte    = -$80
#PB_MaxByte    =  $7F
#PB_MinAscii   =  $00
#PB_MaxAscii   =  $FF

#PB_MinWord    = -$8000
#PB_MaxWord    =  $7FFF
#PB_MinUnicode =  $0000
#PB_MaxUnicode =  $FFFF

CompilerIf SizeOf(Character) = 1
  #PB_MinCharacter = #PB_MinAscii
  #PB_MaxCharacter = #PB_MaxAscii
CompilerElse
  #PB_MinCharacter = #PB_MinUnicode
  #PB_MaxCharacter = #PB_MaxUnicode 
CompilerEndIf

#PB_MinLong = -$80000000
#PB_MaxLong =  $7FFFFFFF
#PB_MinQuad = -$8000000000000000
#PB_MaxQuad =  $7FFFFFFFFFFFFFFF

CompilerIf SizeOf(Integer) = 4
  #PB_MinInteger = #PB_MinLong
  #PB_MaxInteger = #PB_MaxLong
CompilerElse
  #PB_MinInteger = #PB_MinQuad
  #PB_MaxInteger = #PB_MaxQuad 
CompilerEndIf

Re: PB constants for min-max limits according to variable ty

Posted: Sat Jan 26, 2013 7:45 pm
by Denis
I ask to have PB constant, not mine, no compiler bla bla to put :wink:
Compiler will do the job