IonicWind Software

Aurora Compiler => General Discussion => Topic started by: talun on November 09, 2007, 07:41:04 AM

Title: Array usage
Post by: talun on November 09, 2007, 07:41:04 AM
After goes crazy for understanding the problem for which a routine of calculation with an array furnished absurd values, I have understood that it is always necessary to initialize a static array before its use (differently from the Emergence Basic).
Just for curiosity, can anyone say me if this behaviour is typical of other languages or it is exclusive for Aurora?

thanks!

Sergio


Title: Re: Array usage
Post by: Ionic Wind Support Team on November 09, 2007, 08:11:05 AM
Arrays are no different in Aurora than they are in Emergence.

If you are defining the array as a subroutine local variable then it is uninitialized since it is located on the stack.  If the array is a global variable in either language then it will be initilized to all zeros when the executable is loaded by the OS.

In either case you can initialize an array to all zeros by using a single API function.


declare import, RtlZeroMemory(dest as pointer, length as int)

def myarray[20,10] as int
RtlZeroMemory(myarray, LEN(myarray) )


Title: Re: Array usage
Post by: talun on November 09, 2007, 08:20:34 AM
Ok, all is clear;  my array defintion was located in a sub.
I will use the RtlZeroMemory system.

Thank you  :D

Sergio