File Options > Run-time Error tab

(Builder: Project > Options for Selected Files... > Run-time Error tab)

Select the options that enable the desired error checks. Most of these checks occur at run-time, although some occur at compile time.

Memory checking (drop-down list)

Default

Maintains the previous or inherited setting. Originally, the default is None.

None

Disengages memory checking.

Allocation

Equivalent to the -check=alloc command line option. Enables the Debugger's findleaks command and checks for the following memory errors. (See also "Finding memory leaks".)

If the program attempts to free memory not previously allocated, this error is reported:

Attempt to free something not allocated

If the program attempts to free memory already free, sometimes the previous error message is reported here. Otherwise, this error is reported:

Attempt to free something already free

If the program attempts to allocate memory after various other errors occurred, this error report appears:

Malloc internals (free list?) corrupted

Memory

Generates an error message when the program tries to access memory that is not yet allocated. (Equivalent to the -check=memory command line option.). It displays the appropriate Allocation error messages, above, in addition to the following:

Attempt to read/write memory not yet allocated

Array Bounds

Checks array indexes against array bounds. For constant indexes, this check occurs at compile-time; for other expressions at run-time. (Equivalent to the -check=bounds command line option.)

The error message is:

Array index out of bounds

Assignment Bounds

When assigning a value to a variable or field which is a small integral type such as a bit field, this checks if the value is within the range of the type (Equivalent to the -check=assignbound command line option.). The error messages are:

Assignment out of bounds

or
Value outside of type

NULL Dereference

Generates an error message for all dereferences of NULL pointers (Equivalent to the -check=nilderef command line option.). The error message is:

NULL pointer dereference

Case/Switch Statement

Generates a warning if the case/switch expression does not match any of the case/switch labels. This does not apply when using a default case/switch label (Equivalent to the -check=switch command line option.). The error message is:

Case/switch index out of bounds

Divide by Zero

Generates an error message indicating a divide by zero. (Equivalent to the -check=zerodivide command line option.). The error message is:

Divide by 0

Unused Variables

Generates an error message at compile-time for declared variables never used. (Equivalent to the -check=usevariable command line option.). The error message is:

Unused variable

Pascal Variants

Checks that the tag field of a variable declared as a variant record type matches one of the case selectors in the record. This applies only to Pascal (Equivalent to the -check=variant command line option.). The error message is:

Bad variant for reference

Watchpoint

Enables the Debugger command watchpoint to create one watchpoint without using an assertion (Equivalent to the -check=watchpoint command line option.) See also "watchpoint". The error message is:

Write to watchpoint

Return

Generates a warning if a non-void procedure ends without an explicit return. For example, the following procedure generates a warning when exiting:

int func() {
for (int x = 0; x< 10; x++)
{
if (x == 10)
return x;
}
}

This option only applies to C and C++. (Equivalent to the -check=return command line option.). The error message is:

No value returned from function

Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.