Show/Hide Toolbars

XSharp

 

The -az option specifies that array elements begin with 0, rather than with 1 (the default).

Syntax

-az[+|-]

Arguments

+ | - Specifying +, or just -az, directs the compiler to use 0-based array indexing rather than 1-based indexing.

Remarks

This option is off by default, since it would break existing Visual Objects source code. If you prefer to use 0-based arrays with existing code written for Visual Objects, you will need to examine every place in your source code that uses arrays and manually make the appropriate adjustments.

 

Note: This option does not affect how the assembly being compiled is used from other applications. When The -az option is not used, the compiler generates code to subtract 1 from the array index in order to provide 1-based array indexing semantics at the language level. When The -az option is used, the compiler does not adjust array indexes. Either way, the resulting arrays are always 0-based at the IL level, which allows compatibility with all other .NET languages.

 

To set this compiler option in the Visual Studio development environment:

 

1.Open the project's Properties page.

2.Click the Language tab.

3.In the General section, modify the "Use Zero Based Arrays" property.

4.Click here to see the property page

Example

 

FUNCTION Start() AS VOID
       LOCAL DIM a[1] AS INT
       ? a[0] -/ runtime error when -az switch is NOT used
       ? a[1] -/ runtime error when -az switch is used
 RETURN