Setup C++ courses
About the C/C++ course
The
ANSI-C++ standard has standardized and
extended the
C++ language. Extensions to the language previously
resulted in changes of setup of the
C/C++ lectures. Currently
we assume that your compiler supports standard
C++26.
The C++ consists of three parts (I, II and III). Attending only the
first part is like walking on one leg. It barely gets you where you want to
be. Part II targets what many consider the core elements of the
language, and you should really try to attend this part. Part III is intended
for those participants who are really interested in the language and how to
make the compiler generate the correct code for you. To
paraphrase Colin Fletcher (the Complete Walker, Knopf, 1978):
it turns you
from an insecure biped to a confident triped (p. 49).
See this file for
a description of the rating procedure that is used during the course.
Another important reason for reorganizing the course is of course the
continuing growth of C++ as a language. Consequntly the course is
frequently adapted so that the new elements and language philosophy are
covered during the course.
The Software
Participants are free to select the software they want to use during these
courses. In particular: you're free to select your favorite
compiler. However, not every compiler supports every part of the
C++
standard equally well.
During this course using an Integrated Developmental Environment
(IDE) is strongly discouraged as such an environment often results in
a reduction of `insight' and easily lures you into questionable programming
techniques.
Participants are advised to use the GNU g++ compiler, which is
available on most (all?) operating systems. The GNU g++ compiler was
developed within the context of the philosophy of the
Free Software Foundation
meaning (among other things) that everybody may download and use the
software for free.
For this course you should use a recent GNU g++ compiler. No
support can be given to participants using a different compiler, and no rights
can be derived from using compilers not adhering to or using less complete
implementation standards than the GNU g++ compiler version
16.1.0
. Usually a slightly older version
(e.g., the last minor-release of the previous major release) is acceptable, at
least for the first part of the course.
How to install the GNU g++ compiler on Unix systems
Below the steps are described which could be taken to install the
GNU
g++ compiler on a
Unix operating system:
- Assumption: the Unix-system is actually a Linux
system, as installed from a standard distribution, like Ubuntu or
Debian.
- Install the compiler using the standard procedure for installing
software, given the used distribution.
- That's all.
Participants attending the C++ should have installed the necessary
software before the course's first lecture, as the compiler is going to be
used right from the start.
C++
The
C++ language is an elaborate language,
consisting of seven main
facets. Only two of these facets were
already present in the
C programming language, and then only
partially.
C++ is also a beautiful language, showing features not commonly
encountered in other languages:
- it's completely standardized (by an official ANSI/ISO standard);
- it's available on a wide range of platforms;
- it offers direct access to low-level (hardware) features;
- it offers a great implementation of modern views on object based and
oriented programming (do you know the difference?);
- it's a direct descendant of the C programming language, which was
used in the past (and is still being extensively used) to construct virtually
all professional-level software.
Because of all this
C++ is the language of choice for a large number of
major software engineering projects. It may very well become your language of
choice too.
Having learned C++ opens an easy road to an wide range of
C-like languages (including C itself). Since C++ is a
direct descendant of C, it is very well suited as a primary computer
language, not requiring novices to plunge immediately into complex object
oriented programming concepts, which are usually well beyond a novice's level
of com- and apprehension.
The C++ course covers all seven facets of the C++ computer
language. These facets are:
- The primary grammar: statements, expressions and operators which were
(for the greater part) already available in C (but not all; some of
C++'s additions are l- and r-value references; several new data types;
strict use of const; range-based for loops; and lambda
functions.
- The procedural part: the tools the language has to offer for
top-down programming: functions etc.. But again there are extensions:
C++ offering overloaded functions, default function arguments,
fine-grained scoping-rules and the ability to reducing life-times to sensible
blocks;
- The exception handling mechanism, obliterating the need for
(local and non-local) goto's and unsafe exit() calls;
- Object-based programming: Classes, Operator overloading,
Function objects: tools to construct objects helping us to solve
programming problems in a far more natural way than offered by the
(now traditional) top-down decomposition methods (without loosing all the
benefits of those methods);
- Generic Algorithms: Generic Algorithms, implemented
using templates, offer implementations of a wide range of commonly
occuring programming problems, idependently of the actual data types
on which the algorithms operate.
Related to the generic algorithms: the Standard Template Library
and the so-called Abstract Container Types are also covered.
- Object oriented programming: inheritance, polymorphism, virtual
functions, class-hierarchies: methods to develop reusable
software: software that can easily be extended, modified and reused in various
situations in ways completely different from and vastly more powerful than
offered by earlier paradigms. One of the more amazing features of object
oriented programming being that software developed earlier in time
may use characteristics of software developed later in time. Object
oriented programming has shown its value in developing a standard set of
design patterns when developing reusable software. These design
patterns are also introduced and (partially) covered by the C++
course.
- The template mechanism itself: developing abstract `recipes' for
both functions and classes which may then be used by the compiler to actually
create new functions and classes based on these recipes. The compiler
can do this without requiring the programmer to provide
concrete implementations of these functions and classes. Templates are very
important in current-day C++ programming, as all abstract containers
and generic algorithms use templates. During the C++ course
participants learn to develop their own templates, as well as a `feel'
for the situations in which they may be used profitably.
Templates not only allow the compiler to create code on-the-spot from
recipes we've presented the compiler with, but it turns out that the template
mechanism has allowed programmers to do things compile-time that were
heretofore impossible to do. The aphorism never do run-time what you can
do compile-time has left the level of a hollow phrase in C++ where
it is possible to take full control of the compiler by actually programming
it. This has resulted in remarkable results, like having the compiler
generate series of prime numbers or completely changing memory allocation
schemes in 10 seconds.
The three parts of the C++ course cover the various facets of
the C++ in (loosely) the order mentioned above. In addition to the
topics that are `purely' C++ several meta topics, like the use
of tools for generating lexical scanner and parser classes
are covered by the third part of the C++ course. These tools allow
software engineers to design their own grammars and input languages.
The course's setup.
Part I:
During the first part of the
C++ course we focus
on the primary grammar: following the initial lectures, covering basic
concepts like source code organization and layout; compilation
vs. interpretation; using and designing software libraries,
C++
expressions, statements and (free) functions are discussed. This opens the
road to `procedural (structured) programming'.
At this point we're ready to introduce `Object Based Programming', introducing
classes, objects, construction, and composition.
C++ introduces, different from C's FILE-based
input/output (I/O) stream-based I/O. Stream-based I/O is closely
related to object oriented programming, but it can be em(used) before those
latter concepts are well introduced. Having covered the basics of object based
programming the course moves to an in-depth coverage of stream-based I/O.
C++ shares facilities for memory allocation with C
(albeit that C++ adds many more features to those offered by
C). By the end of part I arrays and pointers, including fundamental
forms of memory allocation, among which placement new has been
covered.
Partiipants who completed part I of the C++ course are able to
- Develop and understand basic C++ programs, primarily using the
`structured programming' methode of program development.
- Develop and use their own basic C++ classes,
- Use stream-based I/O
- Dynamically (and safely) allocate memory
- Use pointers, both to data and to code (functions)
This part's topics are listed in
this overview.
Part II:
In this part Object Based and Object Oriented programming are the main
topics. Continuing where the first course ended, the
ins and
outs of classes are covered. This eventually results in programs in
which design patterns and other advanced methods to construct software may be
used.
Many C++ programs heavily use templates: abstract containers,
allowing the software engineer to construct complex data structures with
little effort. These containers are also covered during this part. The actual
use of generic algorithms and the construction of templates is not covered in
this part of the course.
Participants who completed part II of the C++ course are able to
- Develop and understand advanced C++ programs
in which inheritance and polymorphism are extensively used;
- Develop and use their own class hierarchies;
- Develop protocols using Abstract Base Classes,
which may also be their own design;
- Apply certain design patterns and recognize arguments for
applying them;
- Overload operators and recognize arguments for overloading operators;
- Avoid goto's and exit() calls, using exceptions
instead. Arguments for using exceptions (i.e., recognizing
exceptional circumstances) are also studied.
This part's topics are listed in
this overview.
Part III:
This part of the course aims at advanced (but important and frequently used,
make no mistakes about this) topics of the
C++ programming language.
Also, tools for generating lexical scanner and parser classes are
introduced and used.
Participants who completed part III of the C++ course are able to
- Design and understand complex C++ programs. By the end of this
course participants have had exposure to and hands-on experience with
practically all elements of the C++ programming
language. Participants having completed the full (rhather than
lightweight (see below) course may consider themselves
highly experienced C++ programmers;
- Use advanced tools like lexical scanner and parser class generators
to design their own artificial (input) languages;
- Apply (and recognize arguments for doing so) generic algorithms,
including advanced ranger templates enlarging the
applicability of generic algorithms and/or range-based for loops even
further;
- Design their own template functions and classes;
This part's topics are listed in
this overview.
Exercises and training
For all three parts ample means are provided to gain mastery of the
C++
language. We use an electronic mailing list and/or signal group, participants
may contact me (also outside standard office hours), and many
exercises are presented, which must be completed within a limited period of
time. This ensures constant exposure to the language, which has beneficial
learning effects.
If you're interested in C++ then you're more than welcome to
join and attend the C++ courses. Contact me by e-mail or phone (+31 6
5353 2509) if you have any questions about this course.
Frank B. Brokken
(frank@oosix.mx10.nl)
22 June 2026