0% found this document useful (0 votes)
58 views2 pages

Understanding C++ Quick Reference

The document summarizes key elements of the C++ preprocessor including directives like #include, #define, #undef, and conditional compiling directives like #if and #ifdef. It also provides a lookup table summarizing the logic of common operators like logical AND, logical OR, and logical XOR in C++.

Uploaded by

Jessica Monteiro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views2 pages

Understanding C++ Quick Reference

The document summarizes key elements of the C++ preprocessor including directives like #include, #define, #undef, and conditional compiling directives like #if and #ifdef. It also provides a lookup table summarizing the logic of common operators like logical AND, logical OR, and logical XOR in C++.

Uploaded by

Jessica Monteiro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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