Skip to content
Paul Squires edited this page Oct 30, 2026 · 4 revisions

Home › Preprocessor › #pragma

#pragma

Preprocessor directive

Syntax

#pragma option [ = value ]
#pragma push ( option [, value ] )
#pragma pop ( option )

Parameters

  • option
  • value

Description

Allows the setting of compiler options inside the source code.

Push saves the current value of the option onto a stack, then assigns the new value (or True) to it. Pop restores the option to its previous value, and removes it from the stack. This mechanism allows options to be changed for a certain part of source code, regardless of the setting used by the context, which is especially useful inside #include header files.

constness pragma is added for testing the compiler. It will be removed in future at should not be relied upon.

Remarks

Differences from QB

  • New to FreeBASIC

See also

Examples

'' MSVC-compatible bitfields: save the current setting and then enable them

#pragma push(msbitfields)

'' do something that requires MS-compatible bitfields here

'' restore original setting

#pragma pop(msbitfields)

Category: Preprocessor
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally