[futurebasic] Re: [FB] FortranEquivalence

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2005 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Tue, 2 Aug 2005 14:42:22 +1200

> Alain Pastor wrote:
>
> As I read it, the ;0 with arrays tells the Compiler to store the  
> arrays declared on the same statement line consecutively in RAM
>


This is true of arrays on the stack, but not of global arrays. The  
latter are allocated as Handle blocks at app startup and are  
therefore always separate.


'----------
local fn Test
dim as long a(2);0, b(2)
dim as long j
print "Local arrays can occupy the same storage"
for j = 0 to 2
a(j) = j
b(j) = 1000 + j
next
for j = 0 to 2
print a(j), b(j),
if ( a(j) == b(j) ) then print "==" else print "!="
next
end fn

begin globals
dim as long gA(2);0, gB(2)
end globals

dim as long j
print "Global arrays cannot occupy the same storage"
for j = 0 to 2
gA(j) = j
gB(j) = 1000 + j
next
for j = 0 to 2
print gA(j), gB(j),
if ( gA(j) == gB(j) ) then print "==" else print  "!="
next

print
fn Test
stop
'----------

Robert P.