#pragma assert non_zero(sizeof(a) == 12) "a is the wrong size"

In this example, if the compiler determines that sizeof(a) is not 12, the following diagnostic message is output:

"foo.c", line 10: error #2020: The assertion "(sizeof(a) == 12)" was not true. a is the wrong size

Consider the following example that verifies both the size of a struct and the offset of one of its elements:

#include <stddef.h> typedef struct {

int a; int b;

} s;

#pragma assert non_zero(sizeof(s) == 8) "sizeof assert failed" #pragma assert non_zero(offsetof(s,b) == 4) "offsetof assert failed"

This pragma provides a similar behavior to that of the Tru64 C compiler.

BINDING Pragma

#pragma BINDING {hiddenprotectedexterndefault}

Global symbols that follow this pragma will be given a specific binding. Command-line options and binding pragmas referring to specific symbols (for example, pragma hidden symbol) override this pragma. This pragma will override command-line bindings that do not refer to a specific symbol (for example, -Bprotected).

DEFAULT_BINDING Pragma

#pragma DEFAULT_BINDING [symbol{,symbol}]

Global symbols are assigned the default export class. These symbols may be imported or exported outside of the current load module. The compiler will access tentative and undefined symbols through the linkage table. Any symbol that is not assigned to another export class through use of another -Boption will have the default export class.

ESTIMATED_FREQUENCY Pragma

#pragma ESTIMATED_FREQUENCY f

This block-scoped pragma allows you to tell the compiler your estimate of how frequently the current block is executed as compared to the immediately surrounding block. You can indicate the average trip count in the body of a for loop or the fraction of time a then clause is executed. Frequency, f can be expressed as a floating point or integer constant. The compiler accepts preprocessor expressions that evaluate to a compile time constant.

EXTERN Pragma

#pragma EXTERN [symbol{,symbol}]

The specified symbols, or all undefined symbols if no list is provided, are assigned to the default export class. Additionally, the compiler will inline the import stub for calls to these symbols. No compile time binding of these symbols will be done. All references to these symbols will be through the linkage table, so an unnecessary performance penalty will occur if extern is applied to a listed symbol that is resolved in the same load module. This is the pragma equivalent of -Bexternand is global in scope.

FREQUENTLY_CALLED Pragma

#pragma FREQUENTLY_CALLED [symbol{,symbol}]

This file-scoped pragma identifies functions that are frequently called within the application. The pragma must be placed prior to any definition of or reference to the named function. If not, the

106 Pragma Directives and Attributes