Cpp

toc
 * Home * Programming * Languages * C++**


 * C++** is a pragmatical, object oriented general-purpose programming language, initially an extension of C and designed and implemented in 1979 by Bjarne Stroustrup from the Bell Laboratories. C++ is pragmatical because one may write in "usual" C-style, using the [|C standard library] (printf, strcpy, ...), except perhaps using C++ comments and references up and then (instead of pointer). On the other hand C++ allows to design classes and interfaces (pure virtual classes) in a more object oriented manner. There are lots of free and commercial class libraries for arithmetics, database related stuff, portable and proprietary window management and whatever else.

=C Extensions=

Exception Handling

 * [|C++ Programming/Exception Handling from Wikibooks]
 * [|Exceptions - C++ Reference]
 * [|exception - C++ Reference]
 * [|C++ Exception Handling] from [|MSDN Library]
 * [|C++ exception-handling tricks for Linux] from IBM

=Classes= Classes as declaration for objects are more or less C-Structures. None static functions may be declared inside the scope of a class. Those functions, called Member function have an implicit parameter called "this", a pointer to this structure, allocated either inside the data segment as static or global, via "new" (malloc) on the heap or as automatic object (variable) on the stack.


 * [|C++ classes from Wikipedia]

Data Definition

 * [|Basic declaration and member variables from Wikipedia]

Member Functions

 * [|Member functions from Wikipedia]

Pointer to member-functions
For instance an array of member-function pointers of a class //CNode//, which is indexed by arbitrary pieces code - as switch-case replacement via indirect call/jump. The special atomic C++ operator ' ->* ' is used to call the indexed member-functions: code format="cpp" class CNode { U64 AssertAttack (EnumSquare sq) const; U64 wPawnAttacks (EnumSquare sq) const; U64 bPawnAttacks (EnumSquare sq) const; U64 knightAttacks(EnumSquare sq) const; U64 kingAttacks (EnumSquare sq) const; U64 bishopAttacks(EnumSquare sq) const; U64 rookAttacks (EnumSquare sq) const; U64 queenAttacks (EnumSquare sq) const; ... typedef U64 (CNode::*AttackPtrType)(EnumSquare sq) const; static AttackPtrType m_scPieceAtta[14]; ...

U64 getAttack(EnumSquare sq, EnumPiece piece) const {return (this->*m_scPieceAtta[piece])(sq);} };

CNode::AttackPtrType CNode::m_scPieceAtta[14] = { AssertAttack, AssertAttack, wPawnAttacks, bPawnAttacks , bishopAttacks, bishopAttacks, knightAttacks, knightAttacks, rookAttacks, rookAttacks, kingAttacks, kingAttacks, queenAttacks, queenAttacks }; code

Inheritance

 * [|Inheritance (object-oriented programming) from Wikipedia]
 * [|Inheritance from Wikibooks]

Function overloading

 * [|Function overloading from Wikipedia]

Operator overloading

 * [|Operator Overloading from Wikibooks]

Late binding

 * [|Late binding from Wikipedia]
 * [|Virtual method table from Wikipedia]
 * [|Virtual function from Wikipedia]

Abstract Classes

 * [|Abstract Classes from Wikibooks]

Pure Abstract Classes

 * [|Pure Abstract Classes from Wikibooks]

Multiple Inheritance
 =Templates= include page="Cpp Templates to include" =Class Design of a Chess Engine= //main article// Class Design of a Chess Engine  =C++ Compiler= > [|GCC Explorer - Interactive Compiler]  =Libraries= > [|NIH Class Library — Software Preservation Group], The Computer History Museum
 * [|Multiple inheritance from Wikipedia]
 * [|List of C/C++ compilers from Wikipeadia]
 * GCC
 * [|Intel C++ Compiler from Wikipeadia]
 * [|Visual C++ from Wikipeadia]
 * [|Standard Template Library from Wikipeadia]
 * [|STL Containers - C++ Reference]
 * [|C++ Libraries — Software Preservation Group], The Computer History Museum
 * [|C++ Big Integer Library] from [|Matt McCutchen's Web Site] in the [|public domain]
 * [|Qt Cross-Platform Application Framework] by [|Trolltech]
 * [|Loki (C++) from Wikipedia] by [|Andrei Alexandrescu] as part of his book //[|Modern C++ Design]//.
 * BITSCAN, a C++ library for bitstrings by Pablo San Segundo
 * [|Boost (C++ libraries) from Wikipedia]
 * [|The Better String Library] by Paul Hsieh from [|SourceForge]
 * [|Log4cplus Project Page]
 * [|Platinum C++ Framework]
 * [|Reason - C++ Library]
 * [|Senjo C++ UCI Adapter] by Shawn Chidester » Clubfoot, UCI

=See also=
 * De Bruijn Sequence Generator
 * Generic Programming
 * SSE2 - SSE2-Wrapper in C++

=C++ Publications=

1985 ...

 * Bjarne Stroustrup (**1985, 1991, 1997, 2000**). //[|The C++ Programming Language]//. [|Addison-Wesley]
 * Keith E. Gorlen (**1987**). //An Object-Oriented Class Library for C++ Programs//. [|C++ Workshop 1987], pp. 181-208
 * Bjarne Stroustrup, Andrew Koenig (**1989**). //C++: as close as possible to C -- but no closer//. [|C++ Report], Vol. 1, no. 7

1990 ...

 * Andrew Koenig, Bjarne Stroustrup (**1990**). //Exception Handling for C++//. Proc [|USENIX C++ Conference 1990], Also, [|Journal of Object Oriented Programming], Vol. 3 No. 2
 * Keith E. Gorlen, [|Sanford M. Orlow], [|Perry S. Plexico] (**1990**). //[|Data abstraction and object-oriented programming in C++]//. [|Wiley]
 * Andrew Koenig, [|Thomas A. Cargill], Keith E. Gorlen, [|Robert B. Murray], [|Michael Vilot] (**1991**). //How Useful is Multiple Inheritance in C++?// [|C++ Conference 1991]
 * Andrew Koenig (**1992**). //Space-Efficient Trees in C++//. [|C++ Conference 1992]
 * [|Scott Meyers] (**1992,2005**). //[|Effective C++: 50 Specific Ways to Improve Your Programs and Designs]//. [|Addison-Wesley]
 * Andrew Koenig (**1994**). //Templates and Generic Algorithms//. [|JOOP 7 No. 3]
 * Andrew Koenig (**1994**). //Generic Iterators//. [|JOOP 7, No. 5]
 * Bjarne Stroustrup, Andrew Koenig, [|Barbara Moo] (**1994**). //The C++ Programming Language//. [|Encyclopedia of Software Engineering], [|Wiley], ISBN 0-471-54004-8.

1995 ...

 * Andrew Koenig, Bjarne Stroustrup (**1995**). //Foundations for Native C++ Styles//. [|Software Practice and Experience], Vol 25, special issue S4
 * Patrick Winston (**1995**). //[|On To C++]//
 * Greg Wilson and Paul Lu (eds.) (**1996**). //[|Parallel Programming Using C++]//. MIT Press.
 * Leen Ammeraal (**1996**). //[|Algorithms and Data Structures in C++]//. ISBN 0-471-96355-0, Chichester: [|John Wiley]
 * Andrew Koenig, [|Barbara Moo] (**1997**). //[|Ruminations on C++]//. [|Addison-Wesley], ISBN 0-201-42339-1
 * Leen Ammeraal (**1997**). //[|STL for C++ Programmers]//. ISBN 0-471-97181-2, Chichester: [|John Wiley]

2000 ...

 * Andrew Koenig, [|Barbara Moo] (**2000**). //[|Accelerated C++]//. [|Addison-Wesley], ISBN 0-201-70353-X
 * Leen Ammeraal (**2000**). //[|C++ for Programmers]//. ISBN 0-471-60697-9, Chichester: [|John Wiley]
 * Bjarne Stroustrup, Andrew Koenig, [|Barbara Moo] (**2001**). //The C++ Programming Language//. [|Encyclopedia of Software Engineering]. [|Wiley]
 * [|Andrei Alexandrescu] (**2001**). //[|Modern C++ Design: Generic Programming and Design Patterns Applied]//.
 * [|Robert L. Akers], Ira Baxter, [|Michael Mehlich] (**2004**). //Invited application paper: re-engineering C++ components via automatic program transformation//. [|PEPM 2004], [|pdf]

2005 ...

 * [|Robert L. Akers], Ira Baxter, [|Michael Mehlich], [|Brian J. Ellis], [|Kenn R. Luecke] (**2005**). //[|Reengineering C++ Component Models via Automatic Program Transformation]//. [|WCRE 2005]
 * [|Robert L. Akers], Ira Baxter, [|Michael Mehlich], [|Brian J. Ellis], [|Kenn R. Luecke] (**2007**). //Case study: Re-engineering C++ component models via automatic program transformation//. [|Information & Software Technology, Vol. 49, No. 3]
 * Bjarne Stroustrup (**2008**). //[|Programming -- Principles and Practice Using C++]//. [|Addison-Wesley], ISBN 978-0321543721

2010 ...

 * [|Robert C. Seacord] (**2010**). //Dangerous Optimizations and the Loss of Causality//. CS 15-392 © 2010 Carnegie Mellon University, [|slides as pdf]
 * [|Anthony Williams] (**2012**). //[|C++ Concurrency in Action: Practical Multithreading]//.
 * [|Xi Wang], [|Haogang Chen], [|Alvin Cheung], [|Zhihao Jia], [|Nickolai Zeldovich], [|M. Frans Kaashoek] (**2012**). //Undefined Behavior: What Happened to My Code//? [|pdf]
 * [|Will Dietz], [|Peng Li], [|John Regehr], [|Vikram Adve] (**2012**). //Understanding Integer Overflow in C/C++//. [|pdf]

=Andrew Koenig at Dr Dobbs= include page="Andrew Koenig at Dr Dobbs to include" =Forum Posts=

1997 ...
> [|Re: Search Degredation w/ C++] by Amir Ban, rgcc, June 17, 1997 > [|Re: object oriented chess programming] by Dave Fotland, rgcc, January 06, 1998
 * [|Search Degredation w/ C++] by Chris Jason Richards, rgcc, June 12, 1997
 * [|Question to Amir Ban] by Bas Hamstra, CCC, November 05, 1997
 * [|object oriented chess programming] by James Long, rgcc, December 31, 1997
 * [|C or C++ for chess programming: speed] by Marc-Philippe Huget, CCC, October 20, 1999

2000 ...

 * [|C++ Programming Q: are const and define efficiency the same] by Federico Corigliano, CCC, January 16, 2004
 * [|Kiwi for Win98 and input-reading stuff] by Alessandro Scotti, CCC, September 29, 2004 » Kiwi, Windows, Thread

2005 ...

 * [|Find The Bug - C / C++] by David Rasmussen, [|bytes.com], July 22, 2005 » Chezzz
 * [|forcing compilers to inline (or to not inline)] by Wylie Garvin, CCC, May 04, 2008

2010 ...

 * [|c or c++ ?] by ethan ara, CCC, July 10, 2011
 * 2012**
 * [|C++ templates question] by José C. Martínez Galán, CCC, January 18, 2012
 * [|C++11 for chess engines] by Marco Costalba, CCC, September 03, 2012
 * [|Has GCC caught up with Intel with respect to performance?] by Don Dailey, CCC, October 07, 2012
 * 2013**
 * [|Need Help Getting GCC Working?!?] by Steve Maughan, CCC, April 23, 2013
 * [|[ub Objectives and tasks for SG12]] by [|Gabriel Dos Reis], [|Open Standards], [|The ub Archives], May 29, 2013
 * [|C++ Question] by Ted Wong, CCC, July 30, 2013 » Thread
 * 2014**
 * [|C++11 threads seem to get shafted for cycles] by User923005, OpenChess Forum, March 18, 2014 » Parallel Search, Senpai, Thread
 * [|c++11 std::atomic and memory_order_relaxed] by Kevin Hearn, CCC, April 01, 2014 » Memory
 * [|C++ puzzle] by Marco Costalba, CCC, April 12, 2014
 * [|std::vector<> considered harmful] by Folkert van Heusden, CCC, September 25, 2014 » Move List, Array

2015 ...

 * [|Polling standard input from C++] by Steven Edwards, CCC, May 10, 2015
 * [|BMI2 intrinsics in gcc] by Álvaro Begué, CCC, May 14, 2017 » BMI2
 * [|Advantages of C++11 for Chess?] by Steve Maughan, CCC, October 23, 2017

=External Links= > [|Calling conventions for different C++ compilers and operating systems] (pdf) by [|Agner Fog]
 * [|C++ from Wikipedia]
 * [|C++11 from Wikipedia]
 * [|C++ Programming from Wikibooks]
 * [|cplusplus.com - The C++ Resources Network]
 * [|Google C++ Style Guide]
 * [|C++ Notes] by Fred Swartz
 * [|C++ Historical Sources Archive — Software Preservation Group], The Computer History Museum
 * [|Agner Fog's manuals]
 * [|C++ Optimization Strategies and Techniques] by [|Pete Isensee]
 * [|Threads and memory model for C++] by [|Hans J. Boehm]
 * [|C++ Frequently Questioned Answers] by [|Yossi Kreinin]
 * [|comp.lang.c++] The object-oriented C++ language.
 * [|GoingNative 2012 | Channel 9], [|Redmond, WA], February 2 - 3, 2012, with Bjarne Stroustrup, [|Herb Sutter], [|Andrei Alexandrescu], [|Stephan T. Lavavej], [| Chandler Carruth], [|Hans Boehm], and [|Andrew Sutton]

=References=
 * Up one Level**