Title: Re: Ethic
Post by: Charles Pegge on October 01, 2011, 03:26:02 PM
It has been around for a while.
'a' has been automatically created (auto dim)
a=eax
will translate to something like:
mov [ebx+4096],eax
You can do this with any general purpose register but the value will always pass through the eax register, which is used as the accumulator for most integer arithmetic.
This is also possible
a=ecx+edx+42
Charles
Title: Re: Ethic
Post by: Charles Pegge on October 02, 2011, 01:43:50 PM
Hi Peter,
Static arrays require a constant expression to specify the array size, not a variable. I will need to prevent this:
Code: OxygenBasic
indexbase 0
sys dm=2
dim Bild(dm)
Charles
Title: Re: Ethic
Post by: Charles Pegge on October 02, 2011, 02:15:02 PM
Hi Peter,
Code: OxygenBasic
sub fill(int *x, *y, f1, f2)
int j
for j=0 to 5
x(j) = f1
y(j) = f2
Next
EndSub
This works perfectly for arrays of numbers and user-defined types but beware passing arrays of strings in this way.
The technique below will work for filling string arrays and all other arrays too.
string s at a
Code: OxygenBasic
dimstring s(4)
function f(sys a,e)
string t at a
sys i
for i=1 to e
t(i)=chr(i+64)
next
endfunction
f @s,4 '&s,4
print s(2)
Charles
Title: Re: Ethic
Post by: Aurel on October 03, 2011, 05:27:56 AM
Quote
I have no idea, what I can do with strings
:D But i have ;)
Title: Re: Ethic
Post by: JRS on October 03, 2011, 09:54:29 AM
Quote
But good to know that using of strings are very dangerously.
Not if you have a good memory manager. All data is stored as strings internally in SB. The interpreter is smart enough to know if your passing data not appropriate for the requested function being called.
Title: Re: Ethic
Post by: Charles Pegge on October 03, 2011, 10:11:28 AM
Hi Peter,
string s="Oxygen strings are not hard to use :)" putfile "t.txt",ucase s print getfile "t.txt"
Title: Re: Ethic
Post by: Charles Pegge on October 03, 2011, 03:58:49 PM