You are on page 1of 2

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 AND (&&) and Logical OR (||) Lookup Table

Logical OR:

OR True False
True True True
False True False

Logical AND:

AND True False


True True False
False False False

Logical XOR:

XOR True False


True False True
False True False

Retrieved from "https://en.wikibooks.org/w/index.php?


title=Understanding_C%2B%2B/Quick_Reference&oldid=3362404"

This page was last edited on 15 January 2018, at 01:13.

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.

You might also like