Pragmas
You can use #pragma statements to give specific instructions to your compiler.
LabWindows/CVI supports the following types of pragmas:
User Protection
#pragma EnableLibraryRuntimeChecking
#pragma DisableLibraryRuntimeChecking
#pragma EnableFunctionRuntimeChecking
#pragma DisableFunctionRuntimeChecking
For more information about user protection pragmas, refer to Disabling Library Protection Errors for Functions.
Other Compiler Warnings
Using the following pragmas, you can turn on and off compiler/run-time warnings for detecting uninitialized local variables. The following pragmas operate only on the code they surround.
#pragma EnableUninitLocalsChecking
#pragma DisableUninitLocalsChecking
Use the following pragmas to turn on and off compiler warnings for detecting assignments in conditional expressions, such as if, while, do-while, and for. These pragmas operate on a section of a source code file.
#pragma EnableAssignInConditional
#pragma DisableAssignInConditional
Use the following pragmas to turn on and off compiler warnings for unreferenced identifiers, such as function parameters, local variables, and static global variables. These pragmas operate on a section of a source code file. The last pragma in a scope determines whether a warning is generated.
#pragma EnableUnreferencedIdentifiers
#pragma DisableUnreferencedIdentifiers
Use the following pragma to ignore specific unreferenced identifiers such as function parameters, local variables, and static global variables. Consider using this pragma if you want to override the global pragma, EnableUnreferencedIdentifiers.
#pragma IgnoreUnreferencedIdentifiers x y z
x y z is a list of one or more identifiers you want LabWindows/CVI to ignore. You must declare the identifier before the pragma occurs.
Pack Pragmas
#pragma pack
Refer to Structure Packing Pragma for information about using the pack pragma.
You can use the push and pop modifiers to save and restore structure packing. Saving and restoring structure packing is implemented as a stack, last in–first out, and can be nested arbitrarily.
push—Saves the current structure packing. You can use pop to specify an identifier to restore this setting. You also can specify a new value for the structure packing rather than use a separate pack directive.
The following examples demonstrate how to use the push modifier.
#pragma pack(push) /* saves current structure packing */
#pragma pack(push, 1) /* saves current structure packing and specifies a new value */
#pragma pack(push, identifier) /* saves current structure packing and associates an identifier with it */
#pragma pack(push, identifier, 1) /* saves current structure packing, associates an identifier with it, and specifies a new value */
pop—Restores the last structure packing saved with push. You can optionally specify an identifier, in which case the structure packing associated with this identifier is restored. More recently saved structure packings are discarded.
The following examples demonstrate how to use the pop modifier.
#pragma pack(pop) /* restores previous structure packing */
#pragma pack(pop, identifier) /* restores structure packing associated with identifier */
Message Pragmas
#pragma message ("some message")
Use message pragmas to output a given message to the Build Output window.
C99 Extensions Pragmas
Using the following pragmas, you can enable and disable C99 extensions within a source file.
#pragma C99_extensions_off
#pragma C99_extensions_on