Skip to main content

IAR Embedded Workbench for RX 5.20

default_variable_attributes

In this section:
Syntax
#pragma default_variable_attributes[=attribute...]

where attribute can be:

type_attribute
object_attribute
@ section_name
Parameters

type_attribute

See Type attributes.

object_attributes

See Object attributes.

@ section_name

See Data and function placement in sections.

Description

Use this pragma directive to set default section placement, type attributes, and object attributes for declarations and definitions of variables with static storage duration. The default settings are only used for declarations and definitions that do not specify type or object attributes or location in some other way.

Specifying a default_variable_attributes pragma directive with no attributes restores the initial state of no such defaults being applied to variables with static storage duration.

Note: The extended keyword __packed can be used in two ways—as a normal type attribute and in a structure type definition. The pragma directive default_variable_attributes only affects the use of __packed as a type attribute. Structure definitions are not affected by this pragma directive. See __packed.

Example
/* Place following variables in section MYSEC" */
#pragma default_variable_attributes = @ "MYSEC"
int var1 = 42;
int var2 = 17;
/* Stop placing variables into MYSEC */
#pragma default_variable_attributes =

has the same effect as:

int var1 @ "MYSEC" = 42;
int var2 @ "MYSEC" = 17;
See also

location.

object_attribute.

type_attribute.