mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
cosmetics
This commit is contained in:
parent
b7d0d07263
commit
01699b403b
10 changed files with 21 additions and 20 deletions
|
@ -10,7 +10,7 @@ Type const &smaller(Type const &first, Type const &second)
|
|||
|
||||
#else
|
||||
|
||||
// compile with g++ --std=c++20 -fconcepts min.cc
|
||||
// compile with g++ -fconcepts min.cc
|
||||
|
||||
template <typename Type>
|
||||
concept bool HasOpSmaller()
|
||||
|
|
|
@ -40,7 +40,7 @@ The file tt(module.modulemap) itself has a simple organization:
|
|||
|
||||
To create the module the source file must be compiled using the following
|
||||
command:
|
||||
verb( clang++-7 -fmodules --std=c++2a -O2 -c main.cc)
|
||||
verb( clang++-7 -fmodules --O2 -c main.cc)
|
||||
|
||||
All options are required:
|
||||
itemization(
|
||||
|
|
|
@ -15,11 +15,11 @@ classes.
|
|||
Compilation is performed by tt(clang++-7), using three variants:
|
||||
itemization(
|
||||
it() Plain compilation, using the compiler options
|
||||
verb(--std=c++2a -Wall -O2)
|
||||
verb(-Wall -O2)
|
||||
|
||||
it() Compilation using a module. The module tt(bisoncpp) was first created
|
||||
using the compiler options
|
||||
verb(-fmodules --std=c++2a -Wall -O2)
|
||||
verb(-fmodules -Wall -O2)
|
||||
|
||||
and merely compiling tt(main.cc). The generated module was
|
||||
tt(bisoncpp-2VBAIMWQCR12B.pcm), whose size was 13 MB. Following the
|
||||
|
|
|
@ -27,7 +27,7 @@ includefile(exceptions/catch)
|
|||
subsect(The default catcher)
|
||||
includefile(exceptions/defaultcatch)
|
||||
|
||||
sect(Functions that cannot throw exceptions: the `noexcept' keyword)
|
||||
sect(Functions unable to throw exceptions: the `noexcept' keyword)
|
||||
includefile(exceptions/noexcept)
|
||||
|
||||
lsect(IOEXCEPTIONS)(Iostreams and exceptions)
|
||||
|
|
|
@ -7,10 +7,11 @@ versions:
|
|||
ithtq(exceptions (function))(ios::iostate exceptions())
|
||||
(hi(iostate)this member returns the i(state flags) for which the
|
||||
stream will throw exceptions;)
|
||||
itt(void exceptions(ios::iostate state))
|
||||
quote(hi(iostate)this member causes the stream to throw an exception
|
||||
when state tt(state) is observed.)
|
||||
itt(void exceptions(ios::iostate state))nl()
|
||||
hi(iostate)this member causes the stream to throw an exception
|
||||
when state tt(state) is observed.
|
||||
)
|
||||
|
||||
In the I/O library, exceptions are objects of the class
|
||||
hi(failure class) tt(ios::failure), derived from hi(exception class)
|
||||
tt(ios::exception). A tt(std::string const &message) may be specified when
|
||||
|
|
|
@ -11,6 +11,8 @@ compiler which is, among other places, also part of the i(Debian)
|
|||
Always use the latest bf(C++) standard supported by your compiler. When the
|
||||
latest standard isn't used by default, but is already partially implemented it
|
||||
can usually be selected by specifying the appropriate flag. E.g., to use the
|
||||
C++20 standard specify the flag hi(--std=c++20)tt(-)tt(-std=c++20). In the
|
||||
annotations() it is assumed that this flag is used when compiling the
|
||||
examples.
|
||||
C++23 standard specify the flag hi(--std=c++23)tt(-)tt(-std=c++23).
|
||||
|
||||
Note: in the annotations() it is assumed that the lastest available standard
|
||||
is specified using the tt(--std) flag, even if no tt(--std) flag has been
|
||||
specified.
|
||||
|
|
|
@ -9,14 +9,14 @@ may be aggregated using a tt(struct) that merely exists to pass along
|
|||
values. Data protection and functionality is hardly ever an issue. For such
|
||||
cases bf(C) and bf(C++) use tt(structs). But as a bf(C++) tt(struct) is just a
|
||||
tt(class) with special access rights some members (constructors, destructor,
|
||||
overloaded assignment operator) may implicitly be defined. The aggregates
|
||||
capitalizes on this concept by requiring that its definition remains as simple
|
||||
as possible. Aggregates show the following characteristics:
|
||||
overloaded assignment operator) may implicitly be defined. Aggregates
|
||||
capitalize on this concept by requiring that their definitions remain as
|
||||
simple as possible, showing the following characteristics:
|
||||
itemization(
|
||||
it() there are no user provided constructors or user provided inherited
|
||||
constructors (cf. chapter ref(INHERITANCE));
|
||||
it() its non-static data members have public access rights;
|
||||
it() no virtual members;
|
||||
it() their non-static data members have public access rights;
|
||||
it() they have no virtual members;
|
||||
it() when using inheritance, the base classes aren't virtual and only
|
||||
public inheritance is used.
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SUBST(C2a)(tt(C++20))
|
||||
SUBST(C2a)(tt(C++23))
|
||||
|
||||
COMMENT(The following macros are used to define upcoming sections and
|
||||
files. Once they are available, simply remove the `c' to activate
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// compile with --std=c++20 (or later)
|
||||
|
||||
//code
|
||||
#include <iostream>
|
||||
#include <syncstream>
|
||||
|
|
|
@ -76,7 +76,7 @@ When compiling multi-threaded programs using the GNU tt(g++) compiler the
|
|||
|
||||
To create a multi-threaded program defined in a source file tt(multi.cc)
|
||||
the tt(g++) compiler can be called like this:
|
||||
verb( g++ --std=c++14 -pthread -Wall multi.cc)
|
||||
verb( g++ -pthread -Wall multi.cc)
|
||||
|
||||
When several pre-compiled objects must be linked, the ti(-lpthread)
|
||||
hi(linker option: -lpthread)hi(multi threading: -lpthread)
|
||||
|
|
Loading…
Reference in a new issue