A platform combines multiple tutorials, projects, documentations, questions and answers for developers
  • Home (current)
  • Documentations
  • About
  • Login
  1. Home
  2. Documentations
  3. GCC 11 CPP
  4. 4.2. Conditional Syntax

4.2 Conditional Syntax

A conditional in the C preprocessor begins with a conditional directive: ‘#if’, ‘#ifdef’ or ‘#ifndef’.

• Ifdef:
• If:
• Defined:
• Else:
• Elif:
• __has_attribute:
• __has_cpp_attribute:
• __has_c_attribute:
• __has_builtin:
• __has_include:

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-11.1.0/cpp/Conditional-Syntax.html

1. Overview
1. Overview
1.1. Character sets
1.2. Initial processing
1.3. Tokenization
1.4. The preprocessing language
2. Header Files
2. Header Files
2.1. Include Syntax
2.2. Include Operation
2.3. Search Path
2.4. Once-Only Headers
2.5. Alternatives to Wrapper #ifndef
2.6. Computed Includes
2.7. Wrapper Headers
2.8. System Headers
3. Macros
3. Macros
3.1. Object-like Macros
3.10. Macro Pitfalls
3.10.1. Misnesting
3.10.2. Operator Precedence Problems
3.10.3. Swallowing the Semicolon
3.10.4. Duplication of Side Effects
3.10.5. Self-Referential Macros
3.10.6. Argument Prescan
3.10.7. Newlines in Arguments
3.2. Function-like Macros
3.3. Macro Arguments
3.4. Stringizing
3.5. Concatenation
3.6. Variadic Macros
3.7. Predefined Macros
3.7.1. Standard Predefined Macros
3.7.2. Common Predefined Macros
3.7.3. System-specific Predefined Macros
3.7.4. C++ Named Operators
3.8. Undefining and Redefining Macros
3.9. Directives Within Macro Arguments
4. Conditionals
4. Conditionals
4.1. Conditional Uses
4.2. Conditional Syntax
4.2.1. Ifdef
4.2.10. __has_include
4.2.2. If
4.2.3. Defined
4.2.4. Else
4.2.5. Elif
4.2.6. __has_attribute
4.2.7. __has_cpp_attribute
4.2.8. __has_c_attribute
4.2.9. __has_builtin
4.3. Deleted Code
5. Diagnostics
5. Diagnostics
6. Line Control
6. Line Control
7. Pragmas
7. Pragmas
8. Other Directives
8. Other Directives
9. Preprocessor Output
9. Preprocessor Output
10. Traditional Mode
10. Traditional Mode
10.1. Traditional lexical analysis
10.2. Traditional macros
10.3. Traditional miscellany
10.4. Traditional warnings
11. Implementation Details
11. Implementation Details
11.1. Implementation-defined behavior
11.2. Implementation limits
11.3. Obsolete Features
12. Invocation
12. Invocation
13. Environment Variables
13. Environment Variables
Copyright ©2025 TypeError Powered By AnyPost, page cost 85ms.
Privacy Policy