Show/Hide Toolbars

XSharp

The -checked option specifies whether an integer arithmetic statement that results in a value that is outside the range of the data type, and that is not in the scope of a checked or unchecked keyword, causes a run-time exception.

Syntax

-checked[+ | -]

Remarks

An integer arithmetic statement that is in the scope of a checked or unchecked keyword is not subject to the effect of The -checked option.

 

If an integer arithmetic statement that is not in the scope of a checked or unchecked keyword results in a value outside the range of the data type, and -checked+ (/checked) is used in the compilation, that statement causes an exception at run time. If -checked- is used in the compilation, that statement does not cause an exception at run time.

 

The default value for this option is -checked-. One scenario for using -checked- is in building large applications. Sometimes automated tools are used to build such applications, and such a tool might automatically set -checked to +. You can override the tool's global default by specifying -checked-.

 

The VO Compatibility compiler options -ovf and -fovf both set this option

To set this compiler option in the Visual Studio development environment

 

1.Open the project's Properties page.

2.Click the Build property page.

3.Add the option in the "User-Defined Command Line options" property

Example

 

The following command compiles t2.prg. The use of -checked in the command specifies that any integer arithmetic statement in the file that is not in the scope of a checked or unchecked keyword, and that results in a value that is outside the range of the data type, causes an exception at run time.

 

 

xsc t2.prg -checked