Show/Hide Toolbars

XSharp

Purpose

The BEGIN (UN)CHECKED and END (UN)CHECKED keywords mark a block of statements that are compiled with overflow checking enabled or disabled

Syntax

BEGIN CHECKED
  statements
END CHECKED
 
BEGIN UNCHECKED
  statements
END CHECKED

Arguments

 

statements One or more statements or expressions that are compiled with the specified overflow checking

Remarks

 

BEGIN CHECKED ... END CHECKED ensures that a block of code is compiled with a clear overflow checking option, regardless of the compiler option -ovf.

 

BEGIN CHECKED
  LOCAL intValue as INT
  LOCAL dwordValue as DWORD
  intValue := -1
  dwordValue := (DWORD) intValue   // Overflow error
END CHECKED
 
BEGIN UNCHECKED
  LOCAL intValue as INT
  LOCAL dwordValue as DWORD
  intValue := -1
  dwordValue := (DWORD) intValue   // NO Overflow error, dwordValue now has the value UInt32.MaxValue
END UNCHECKED