
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>#pragma implementation-defined preprocessor directive</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
#pragma Implementation-Defined Preprocessor Directive
#pragma text
An implementation may extend the behavior of the preprocessor in any
way it wishes using the #pragma directive. Pragmas not recognized by
a preprocessor are ignored. Pragmas have this general format:
#pragma name
where 'name' is the name of the desired pragma with the proper
arguments, if any.
The compiler currently recognizes the following pragma:
alloc_text(textsegment, function1 [, function2]...)
Used to control the segment in which particular functions
are located to maximize the efficiency of programs using
overlays or swapping. The alloc_text pragma must appear
before the functions are defined, but may appear either
before or after the functions are declared or called. The
functions can be explicitly declared with the 'far'
keyword, or assumed to be far because the medium, large,
or huge memory model was used, or can be explicitly
declared with the "near" keyword (or assumed to be "near"
because the small or compact memory model was used),
provided they are called only by functions in the same
segment.
Note: No more than 10 alloc_text pragmas can appear in the same
compilation unit.
check_pointer([{on|off}])
Flips the state of pointer checking; off if it is on, off
if it is on.
check_stack([{on|off}])
Used to disable and enable stack space checking when a
function is entered. Here are two examples:
#pragma check_stack(off)
#pragma check_stack(on)
Notes: 'off' disables the stack probe while 'on' enables it.
If neither off nor on is specified, the stack probe is
disabled or enabled depending on the presence or absence
of the compile-time switch /Gs.
comment(commenttype[, commentstring])
Used to place a comment record in the object file.
'commenttype' specifies the type of comment record, and
the optional 'commentstring' is a string literal that
provides additional information for some comment types.
The following four types of comment records are accepted
by the comment pragma:
Type Description
-------- ----------------------------------------------
compiler Places the name and version number of the
compiler in the object file. This comment is
ignored by the linker. The "commentstring"
argument is not used.
lib Places a library-search record in the object
file. The 'commentstring' must contain the name
and path of the library you want the linker to
search for.
user Places a general comment in the object file.
This comment is ignored by the linker. The
'commentstring' contains the text of the
comment.
Notes; A macro that expands to a string literal can be used in
place of the 'commentstring' argument.
data_seg([segmentname])
Used to specify the data-segment name used by functions
that load their own data segments. The named segment also
contains all data that would normally be allocated in the
DATA segment. If no segment name is given, the compiler
uses the segment name specified in the /ND switch option
if used, or else it uses the default group DGROUP (do not
use data_seg to specify DGROUP, since it is not a
segment).
function(function1[, function2]...)
Used to selectively generate function calls instead of
intrinsic functions when you compile a program with the
/Oi switch option.
intrinsic(function1[, function2]...)
Used to generate intrinsic versions of selected functions
without using the /Oi switch option. This pragma affects
all functions from the point it appears until either the
next function() pragma specifying the same functions, or
until the end of the source file.
linesize([characters])
Used to set the number of characters per line in the
source listing. The optional 'characters' is an integer
constant between 79 and 132. If no constant is given, the
compiler used the value specified by the /Si option if
used, or else the default value of 79.
loop_opt([{on|off}]):
Used to selectively turn loop optimization on or off when
used with the compiler /Ol or /0x switch options. When
#pragma loop_opt(off)
is encountered, all following loop optimization is
disabled until either
#pragma loop_opt(on)
is encountered, #pragma loop_opt() is encountered with
the compiler options /01 or /0x specified, or the the end
of the source file is reached.
Notes: If no argument is given loop optimization reverts to the
behavior specified on the command line: enabled if the
/Ox or /Ol switch options are selected, disabled
otherwise.
Also, loop_opt can be used to enable or disable loop
optimization for selected loops without using the
compiler switch options.
message(messagestring)
Used to send a message to the standard output during
compilation without terminating the compilation.
'messagestring' is a string literal containing the
message you wish to send, and can be a macro which
expands to a string literal.
optimize[optomization list]
The optimization list may be a, c, e, g, l, n, p, t, w,
or a combination thereof; these are the same letters as used
in switches to the compiler.
pack([{1|2|4}])
Used to specify the byte alignment of structure members.
The structure members are aligned on 1, 2, or 4 byte
boundaries, depending on the option selected. Structures
aligned on 1 byte boundaries are packed the tightest,
with no internal unused bytes, and those aligned with 4
byte boundaries are the loosest.
Notes: To specify the same alignment throughout the entire
source file use the compiler /Zp switch option. To
selectively change alignment for specific structures, use
the pack pragma. To reinstate the packing given on the
command line use the pack pragma with no arguments.
page([pages])
Used to skip the specified number of pages in the source
listing by generating one or more form feeds (page
ejects) in the source listing where the pragma appears.
The optional 'pages' is an integer constant between 1 and
127. If no constant is given, the default value of 1 is
used.
pagesize([lines])
Used to set the number of lines per page in the source
listing. The optional 'lines' is an integer constant
between 15 and 255. If no constant is given, the number
of lines specified in the /Sp option is used; if that
option is absent, the default of 63 lines is used.
same_seg(variable1[, variable2]...)
Used to tell the compiler to assume that the specified
external variables are allocated in the same data
segment. However, you must be sure the variables are
actually put in the same segment by specifying the /ND
compiler switch option.
The same_seg pragma must appear before any of the
variables are used in executable code and after they are
declared. The variables must be declared with 'extern'
storage class, and either declared with the 'far' keyword
or assumed to be far because the compact, large, or huge
memory model was selected.
skip([lines])
Used to skip the specified number of lines in the source
listing. The optional 'lines' is an integer constant
between 1 and 127 that specifies the number of lines to
skip. If no constant is given, it defaults to 1 line.
subtitle(subtitlename)
Used to specify a subtitle for the source listing. The
subtitle appears below the title on each page of the
source listing. 'subtitlename' is a string literal
containing the desired subtitle, and can be a null string
("") to remove a previous subtitle. A macro that expands
to a string literal can be used for 'subtitlename'.
title(titlename)
Used to specify a title for the source listing, which is
printed in the upper left corner of each page of the
listing. 'titlename' is a string literal containing the
desired title, and can be a null string ("") to remove a
previous title. A macro that expands to a string literal
can be used for 'titlename'.
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson