Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP C/HP-UX Reference Manual: HP-UX Systems > Chapter 7 Preprocessing Directives

_Pragma

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

_Pragma is a preprocessing unary operator.

Syntax

_Pragma (string-literal)

_Pragma is a new preprocessing operator and is a part of C99 standards. The string literal is destringized by deleting the L prefix, if present. _Pragma deletes the leading and trailing double quotes, replacing each escape sequence by a double-quote, and replacing the escape sequence by a single backlash. The resulting sequence of characters is processed to produce preprocessor tokens that are executed as if they were preprocessed tokens in a pragma directive.

NOTE: _Pragma operator is recognized only in the ANSI (-Aa) and ANSI extended (-Ae) mode.

The _Pragma operator provides portability in the use of an existing #pragma C preprocessor construct. These pragmas are processed as defined in its implementation. Most C implementations provide pragmas that are very similar in meaning and functionality. The _Pragma operator can be used in the replacement text of a macro, so as to aid in abstracting these specific pragmas a level higher.

Examples

The following examples list the usage of the _Pragma operator:

Example 1:

A directive of the form,

#pragma listing on "..\listing.dir"

can also be expressed as,

_Pragma (listing on \"..\\listing.dir\"")

The latter form is processed as earlier, if it appears literally as shown or it results from macro replacement, as in:

# define LISTING(x) PRAGMA(listing on #x)
# define PRAGMA(x) _Pragma(#x)
LISTING (..\listing.dir)

Example 2:

_Pragma("HPALIGN 4")

expands to

#pragma HPALIGN 4

Example 3:

#define FOO "HPALIGN 4"
_Pragma(FOO)

expands to

#pragma HPALIGN 4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.