Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
56
Task/Integer-overflow/PureBasic/integer-overflow.basic
Normal file
56
Task/Integer-overflow/PureBasic/integer-overflow.basic
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#MAX_BYTE =127
|
||||
|
||||
#MAX_ASCII=255 ;=MAX_CHAR Ascii-Mode
|
||||
|
||||
CompilerIf #PB_Compiler_Unicode=1
|
||||
#MAX_CHAR =65535 ;Unicode-Mode
|
||||
CompilerElse
|
||||
#MAX_CHAR =255
|
||||
CompilerEndIf
|
||||
|
||||
#MAX_WORD =32767
|
||||
|
||||
#MAX_UNIC =65535
|
||||
|
||||
#MAX_LONG =2147483647
|
||||
|
||||
CompilerIf #PB_Compiler_Processor=#PB_Processor_x86
|
||||
#MAX_INT =2147483647 ;32-bit CPU
|
||||
CompilerElseIf #PB_Compiler_Processor=#PB_Processor_x64
|
||||
#MAX_INT =9223372036854775807 ;64-bit CPU
|
||||
CompilerEndIf
|
||||
|
||||
#MAX_QUAD =9223372036854775807
|
||||
|
||||
Macro say(Type,maxv,minv,sz)
|
||||
PrintN(Type+#TAB$+RSet(Str(minv),30,Chr(32))+#TAB$+RSet(Str(maxv),30,Chr(32))+#TAB$+RSet(Str(sz),6,Chr(32))+" Byte")
|
||||
EndMacro
|
||||
|
||||
OpenConsole()
|
||||
PrintN("TYPE"+#TAB$+RSet("MIN",30,Chr(32))+#TAB$+RSet("MAX",30,Chr(32))+#TAB$+RSet("SIZE",6,Chr(32)))
|
||||
|
||||
Define.b b1=#MAX_BYTE, b2=b1+1
|
||||
say("Byte",b1,b2,SizeOf(b1))
|
||||
|
||||
Define.a a1=#MAX_ASCII, a2=a1+1
|
||||
say("Ascii",a1,a2,SizeOf(a1))
|
||||
|
||||
Define.c c1=#MAX_CHAR, c2=c1+1
|
||||
say("Char",c1,c2,SizeOf(c1))
|
||||
|
||||
Define.w w1=#MAX_WORD, w2=w1+1
|
||||
say("Word",w1,w2,SizeOf(w1))
|
||||
|
||||
Define.u u1=#MAX_UNIC, u2=u1+1
|
||||
say("Unicode",u1,u2,SizeOf(u1))
|
||||
|
||||
Define.l l1=#MAX_LONG, l2=l1+1
|
||||
say("Long ",l1,l2,SizeOf(l1))
|
||||
|
||||
Define.i i1=#MAX_INT, i2=i1+1
|
||||
say("Int",i1,i2,SizeOf(i1))
|
||||
|
||||
Define.q q1=#MAX_QUAD, q2=q1+1
|
||||
say("Quad",q1,q2,SizeOf(q1))
|
||||
|
||||
Input()
|
||||
Loading…
Add table
Add a link
Reference in a new issue