Skip to content

Instantly share code, notes, and snippets.

@rikkimax
Created February 22, 2016 14:19
Show Gist options
  • Save rikkimax/c3adea447e269697b4f4 to your computer and use it in GitHub Desktop.
Save rikkimax/c3adea447e269697b4f4 to your computer and use it in GitHub Desktop.

Macro Preprocessor

Syntax

  • #define Identifier Literal

    • Modifies the translation unit
    • Identifier#1 is replaced by Literal#1
  • #undef Identifier

    • Behaves as #define Identifier#1 $empty
  • #ifdef Identifier

    • Retrives from the translation unit
    • Conditional part of file to parse
  • #else Alternative flow of a conditional statement.

    • Follows from:
      • #if
      • #ifdef
      • #elseif
      • #elif
    • Conditional part of file to parse and is always valid
  • #ifndef Identifier If the identifier exists, ignores the given block.

    • Value of Identifier#1 is negated Negation can be:
      • $true or $false
      • $value or $empty
    • Behaves as #ifdef Identifier#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment