1.5.1. Macro definition

A macro definition must contain:

The syntax of a macro definition is as follows:

DEFINE [/R] [return_type] macro_name([parameter_list])
[param_definitions]
{
    macro_body
}
.

where:

/R

The new macro can replace an existing user-defined macro with the same name. If any symbol other than a user-defined macro has the same name as the new macro, then the following error is displayed:

Error: E004D: Symbol with this name already exists.

return_type

The return type for the macro and is an optional component of the macro definition. The type can be any legal C or C++ data type, except const. The default type is int.

Note

One use of a macro return value is to control what action RealView Debugger takes when a breakpoint is activated.

parameter_list

A parameter list for the macro and is an optional component of the macro definition. You specify a parameter list in the same way that you specify arguments for a C function. If parameter_list is defined then the type must also be specified or else type int is assumed. The following example illustrates the use of a parameter_list:

define int scpy(target, source)
char *target;
char *source;

The declaration defines arguments for the macro scpy(). The type of both the target and the source are declared to be pointers to a char.

See also

Copyright © 2002-2009 ARM Limited. All rights reserved.ARM DUI 0175K
Non-Confidential