# alloc_section

Allocates one or more variables in the specified section. Controls section attribute specification for variables.

## Syntax

#pragma alloc_section(var1,var2,..., "r;attribute-list")

## Arguments

var | A variable that can be used to define a symbol in the section.
"r;attribute-list" | A comma-separated list of attributes; defined values are: 'short' and 'long'.

## Description

The alloc_section pragma places the listed variables, var1, var2, etc., in the specified section. This pragma controls section attribute specification for variables. The compiler decides whether the variable, as defined by var1, var2, etc., should go to a "data", "bss", or "rdata" section.

The section name must be enclosed in double quotation marks. It should be previously introduced into the program using #pragma section. The list of comma-separated variable names follows the section name after a separating comma.

All listed variables must be defined before this pragma, in the same translation unit and in the same scope. The variables have static storage; their linkage does not matter in C modules, but in C++ modules they are defined with the extern "C" linkage specification.

## Examples

This example shows how to use #pragma alloc_section:

    #pragma alloc_section(var1, "r;short")
      int var1 = 20;
    #pragma alloc_section(var2, "r;short")
      extern int var2;

Parent topic: Intel-Specific Pragma Reference