> Therefore the code
>
Code:
> IF UseEMS% THEN > DIM VIRTUAL vTest(x) AS WhateverType > ELSE > DIM Test(x) AS WhateverType > END IF
> will reserve memory for two arrays (vTest and Test).
That's not entirely accurate. For example this code (based on your example)...
Code:
UseEMS% = 1 X = 10 IF UseEMS% THEN DIM VIRTUAL vTest(X) AS LONG ELSE DIM Test(X) AS LONG END IF PRINT Test(0)
The difference is "dynamic" vs. "static" arrays. If the array is static, the compiler will create it at compile-time as you described. For example, if you change DIM Test(x) to DIM Test(10) the error will go away. But if you then change it to DIM DYNAMIC Test(10) the error will come back.
Arrays are created dynamically (at runtime) if 1) the subscript is not a numeric literal value, or 2) if you explicitly tell the compiler to DIM DYNAMIC.
-- Eric
------------------
Perfect Sync: Perfect Sync Development Tools
Email: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited March 21, 2000).]
Leave a comment: