Restored from previous forum. Originally posted by richard.
hi,
is there a sizeof in PB to use with structres???
is there a mod function?
thanx
richard
allocation memore - SIZEOF structs
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by WooTz.
Hey,
Can't you calculate the size yourself? integer, long etc. are fixed length, and the string you can get with Len().
As for the mod:
while (numerator >= denominator)
numerator = numerator - denominator;
return numerator
thats just the pseudo code, go ahead and port it im still learning pure basic
Martin
Hey,
Can't you calculate the size yourself? integer, long etc. are fixed length, and the string you can get with Len().
As for the mod:
while (numerator >= denominator)
numerator = numerator - denominator;
return numerator
thats just the pseudo code, go ahead and port it im still learning pure basic

Martin
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by richard.
hi,
sure one can count, but there are a lot of things missing in this basic. all those litte thing that make life nice and easier like - mod, shift ... and sizeof.
for example see gfa basic or the hla assembler http://webster.cs.ucr.edu/.
there are a lot of important things missing, like documentation,containers and other things.
richard
hi,
sure one can count, but there are a lot of things missing in this basic. all those litte thing that make life nice and easier like - mod, shift ... and sizeof.
for example see gfa basic or the hla assembler http://webster.cs.ucr.edu/.
there are a lot of important things missing, like documentation,containers and other things.
richard
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
MessageRequester("", Str(SizeOf(RECT)), 0)
And yes, shift are supported:
FastMulByTwo = Number > 2
It's like in C/C++.
BTW, the PureBasic compiler is smart enough to convert all mul & div by shift when it's possible..
So, only the mod stuff is missing
Fred - AlphaSND
Of course there is a SizeOf() function for structures.. Just try the following line:hi,
sure one can count, but there are a lot of things missing in this basic. all those litte thing that make life nice and easier like - mod, shift ... and sizeof.
MessageRequester("", Str(SizeOf(RECT)), 0)
And yes, shift are supported:
FastMulByTwo = Number > 2
It's like in C/C++.
BTW, the PureBasic compiler is smart enough to convert all mul & div by shift when it's possible..
So, only the mod stuff is missing

Fred - AlphaSND
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm