4.2.7. isalive

Tests the status of the specified symbol.

Syntax

int isalive (symbol_name)
  symbol_name;

where:

symbol_name

The variable name used for the symbol that isalive tests the scope of.

Description

The isalive keyword tests whether the specified symbol is in scope. It checks the status of the argument symbol_name, to see whether that variable is in scope, and whether it can be referenced. The value returned by isalive specifies whether the variable does not exist, is not in scope, is in scope inside the current active function, or is an external (global) variable, or a static variable on the stack but out of scope.

Return value

int

One of the following values

-1

Symbol does not exist.

0

Symbol not currently active. It cannot be referenced because it is out of scope.

1

Symbol currently active. It is part of the local procedure, also called an automatic variable.

2

Available on the stack. The symbol is not part of local procedure, and is also called an external (active), global (active), or static automatic variable (inactive, but containing stored memory contents).

Rules

The argument of isalive must be a variable that has no return value. The argument cannot be a function.

Example

You can use the following syntax for the isalive keyword when checking the status of a variable used in its argument.

CEXPRESSION isalive(xxx)
/* Returns -1 if the symbol xxx does not exist. */
ADD var1
CE isalive(var1)
/* Returns 1 since var1 is defined and active. */

Note

The keywords CEXPRESSION and CE are equivalent.

Copyright © 2005, 2006 ARM Limited. All rights reserved.ARM DUI 0284C
Non-Confidential