Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015
 
 

2.11.1 align

#pragma align integer (variable[, variable])

The align pragma makes all the mentioned variables memory aligned to integer bytes, overriding the default. The following limitations apply:

  • The integer value must be a power of 2 between 1 and 128. Valid values are: 1, 2, 4, 8, 16, 32, 64, and 128.

  • variable is a global or static variable.

  • If the specified alignment is smaller than the default, the default is used.

  • The pragma line must appear before the declaration of the variables which it mentions. Otherwise, it is ignored.

  • Any variable that is mentioned but not declared in the text following the pragma line is ignored. For example:

    #pragma align 64 (aninteger, astring, astruct)
    int aninteger;
    static char astring[256];
    struct astruct{int a; char *b;};