Preprocessor Directives - #pragma

A pragma is an implementation-defined instruction to the compiler. It has the general form given below, where character_sequence is a series of characters that giving a specific compiler instruction and arguments, if any.

The character_sequence on a pragma is subject to macro substitutions, unless otherwise stated. More than one pragma construct can be specified on a single #pragma directive. The compiler ignores unrecognized pragmas, issuing an informational message indicating this.

The following pragmas are available:

Platform and Language Restrictions #pragma Description
align Aligns data items within structures.
alloca Provides an inline version of the function alloca(size_t size).
alloc_text Groups functions into separate 32-bit code segments.
  chars Sets the sign type of character data.
code_seg Marks the current code section in effect.
  comment Places a comment into the object file.
data_seg Places static and external variables in different 32-bit data segments.
define Forces the definition of a template class without actually defining an object of the class.
  disjoint Lists the identifiers that are not aliased to each other within the scope of their use.
( ) & entry Specifies the function to be used as the entry point for the application being built.
  enum Specifies the size of enum variables that follow.
( ) & export Declares that a DLL function is to be exported and specifies the name of the function outside the DLL.
handler Registers an exception handler for a function.
hdrfile Specifies the filename of the precompiled header to be generated and/or used.
hdrstop Manually terminates the initial sequence of #include directives being considered for precompilation.
( ) & import Lets you import a function or a variable from a DLL using either an ordinal number or a name different from the one that it has in the DLL.
  info Controls the diagnostic messages generated by the info(...) compiler options.
  isolated_call Lists functions that do not alter data objects visible at the time of the function call.
langlvl Selects the C language level for compilation.
  leaves Takes a function name and specifies that the function never returns to the instruction after the function call.
library This tells the linker to pull in the appropriate libraries at link time.
linkage Identifies the linkage or calling convention used on a function call.
  map Tells the compiler that all references to an identifier are to be converted to a new name.
margins Specifies the columns in the input line that are to be scanned for input to the compiler.
namemangling Sets the maximum length for external names generated from source code.
options Specifies options to the compiler in your source program.
pack Specifies the alignment rules to use for the structures, unions, and classes that follow it.
page Skips the number of pages of the generated source listing. The number of pages is defined by the user.
pagesize Sets the number of lines per page to user-defined value for the generated source listing.
priority Specifies the order in which static objects are to be initialized at run time.
  reachable Declares that the point after the call to a routine marked reachable can be the target of a branch from some unknown location.
report Controls the generation of specific messages.
seg16 Shares a data object between 16-bit and 32-bit processes.
sequence Defines the section of the input line that is to contain sequence numbers.
skip Skips the specified number of lines of the generated source listing.
stack16 Specifies the size of the stack to be allocated for calls to 16-bit routines.
stack_align Applies the stack alignment rules to the user defined functions.
  strings Sets storage type for strings.
subtitle Places the text specified by subbtitle on all subsequent pages of the generated source listing.
title Places the text specified by the user on all subsequent pages of the generated source listing.
weak Adds an alternate function name with weak binding for the specified function.


Preprocessor Directives - An Overview