Professional Documents
Culture Documents
Understanding C++ Quick Reference
Understanding C++ Quick Reference
Preprocessor
#include Syntax
includes contents of stdio.h
<stdio.h> if (bool expr) block [else block]
display text as compile time for ([expr];[condition];[expr]) block
#error text
error while (condition) block
display text as compile time do { } while (condition)
#warning text
warning
type identifier([type identifier, ...]);
#pragma compiler specific options
type identifier([type identifier, ...]) { }
#define M define M
class identifier [:[private|public] type, ...];
#undef M undefine M
class identifier [:[private|public] type, ...] {
#if (condition) conditional compiling [private:] };
#ifdef M compiled if M is defined struct identifier [:[public|private] type, ...];
#ifndef M compiled if M is not defined struct identifier [:[public|private] type, ...] {
#elif (condition) conditional compiling [public:] };
#else conditional compiling union identifier;
#endif end conditional section union identifier { type identifier; ... };
defined() is macro defined. enum identifier;
!defined() is macro not defined enum identifier { identifier [=int_value], ... }';
M ## D combines M and D into MD typedef type identifier;
#M treat M as string "M"
Logical OR:
OR True False
True True True
False True False
Logical AND:
Logical XOR:
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using
this site, you agree to the Terms of Use and Privacy Policy.