Skip to content

Commit e6d7513

Browse files
committed
Prefer // OK: over // OK, ; // error: over // error, ; // error over // Error.
1 parent 90474c7 commit e6d7513

13 files changed

+98
-98
lines changed

source/access.tex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
};
8989

9090
void f() {
91-
A::BB x; // OK, typedef name \tcode{A::BB} is public
92-
A::B y; // access error, \tcode{A::B} is private
91+
A::BB x; // OK: typedef name \tcode{A::BB} is public
92+
A::B y; // access error: \tcode{A::B} is private
9393
}
9494
\end{codeblock}
9595
\end{note}
@@ -187,7 +187,7 @@
187187
template <class U, class V = typename U::TT>
188188
class D : public U { };
189189

190-
D <C<B> >* d; // access error, C::TT is protected
190+
D <C<B> >* d; // access error: C::TT is protected
191191
\end{codeblock}
192192
\end{example}
193193

@@ -657,7 +657,7 @@
657657
};
658658

659659
class Y {
660-
int v[X::a]; // OK, \tcode{Y} is a friend of \tcode{X}
660+
int v[X::a]; // OK: \tcode{Y} is a friend of \tcode{X}
661661
};
662662

663663
class Z {
@@ -840,15 +840,15 @@
840840
class Y;
841841
extern void b();
842842
class A {
843-
friend class X; // OK, but \tcode{X} is a local class, not \tcode{::X}
843+
friend class X; // OK: but \tcode{X} is a local class, not \tcode{::X}
844844
friend class Y; // OK
845-
friend class Z; // OK, introduces local class \tcode{Z}
846-
friend void a(); // error, \tcode{::a} is not considered
845+
friend class Z; // OK: introduces local class \tcode{Z}
846+
friend void a(); // error: \tcode{::a} is not considered
847847
friend void b(); // OK
848848
friend void c(); // error
849849
};
850-
X* px; // OK, but \tcode{::X} is found
851-
Z* pz; // error, no \tcode{Z} is found
850+
X* px; // OK: but \tcode{::X} is found
851+
Z* pz; // error: no \tcode{Z} is found
852852
}
853853
\end{codeblock}
854854
\end{example}

source/basic.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@
929929

930930
typedef int I;
931931
class D {
932-
typedef I I; // error, even though no reordering involved
932+
typedef I I; // error: even though no reordering involved
933933
};
934934
\end{codeblock}
935935
\end{example}
@@ -1753,7 +1753,7 @@
17531753
B::B() { }
17541754

17551755
B::A ba; // object of type \tcode{A}
1756-
A::A a; // error, \tcode{A::A} is not a type name
1756+
A::A a; // error: \tcode{A::A} is not a type name
17571757
struct A::A a2; // object of type \tcode{A}
17581758
\end{codeblock}
17591759
\end{example}
@@ -1949,7 +1949,7 @@
19491949
namespace C {
19501950
using namespace A;
19511951
using namespace B;
1952-
int i = C::x; // OK, \tcode{A::x} (of type \tcode{int} )
1952+
int i = C::x; // OK: \tcode{A::x} (of type \tcode{int} )
19531953
int j = C::y; // ambiguous, \tcode{A::y} or \tcode{B::y}
19541954
}
19551955
\end{codeblock}
@@ -1977,7 +1977,7 @@
19771977
}
19781978
using namespace B;
19791979
}
1980-
void A::f1(int){ } // ill-formed, \tcode{f1} is not a member of \tcode{A}
1980+
void A::f1(int){ } // ill-formed: \tcode{f1} is not a member of \tcode{A}
19811981
\end{codeblock}
19821982

19831983
\end{example} However, in such namespace member declarations, the
@@ -2000,7 +2000,7 @@
20002000

20012001
using namespace A;
20022002
using namespace C::D;
2003-
void B::f1(int){ } // OK, defines \tcode{A::B::f1(int)}
2003+
void B::f1(int){ } // OK: defines \tcode{A::B::f1(int)}
20042004
\end{codeblock}
20052005
\end{example}
20062006
\indextext{lookup!qualified~name|)}%
@@ -3325,7 +3325,7 @@
33253325
void B::mutate() {
33263326
new (this) D2; // reuses storage --- ends the lifetime of \tcode{*this}
33273327
f(); // undefined behavior
3328-
... = this; // OK, \tcode{this} points to valid memory
3328+
... = this; // OK: \tcode{this} points to valid memory
33293329
}
33303330

33313331
void g() {

source/classes.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@
316316

317317
\begin{codeblock}
318318
struct S { int a; };
319-
struct S { int a; }; // error, double definition
319+
struct S { int a; }; // error: double definition
320320
\end{codeblock}
321321

322322
is ill-formed because it defines \tcode{S} twice.
@@ -781,7 +781,7 @@
781781
union U { T1 t1; T2 t2; };
782782
int f() {
783783
U u = { { 1, 2 } }; // active member is \tcode{t1}
784-
return u.t2.c; // OK, as if \tcode{u.t1.a} were nominated
784+
return u.t2.c; // OK: as if \tcode{u.t1.a} were nominated
785785
}
786786
\end{codeblock}
787787
\end{example}
@@ -1635,7 +1635,7 @@
16351635
struct X { const int a; int b; };
16361636
union Y { X x; int k; };
16371637
void g() {
1638-
Y y = { { 1, 2 } }; // OK, \tcode{y.x} is active union member (\ref{class.mem})
1638+
Y y = { { 1, 2 } }; // OK: \tcode{y.x} is active union member (\ref{class.mem})
16391639
int n = y.x.a;
16401640
y.k = 4; // OK: ends lifetime of \tcode{y.x}, \tcode{y.k} is active member of union
16411641
y.x.b = n; // undefined behavior: \tcode{y.x.b} modified outside its lifetime,

source/conversions.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
}
155155
auto g = f();
156156
int m = g(false); // undefined behavior due to access of \tcode{x.n} outside its lifetime
157-
int n = g(true); // OK, does not access \tcode{y.n}
157+
int n = g(true); // OK: does not access \tcode{y.n}
158158
\end{codeblock}
159159
\end{example}
160160
The result of the conversion is determined according to the
@@ -231,7 +231,7 @@
231231
\begin{example}
232232
\begin{codeblock}
233233
struct X { int n; };
234-
int k = X().n; // OK, \tcode{X()} prvalue is converted to xvalue
234+
int k = X().n; // OK: \tcode{X()} prvalue is converted to xvalue
235235
\end{codeblock}
236236
\end{example}
237237

source/declarations.tex

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@
906906
\begin{codeblock}
907907
constexpr int f(bool b)
908908
{ return b ? throw 0 : 0; } // OK
909-
constexpr int f() { return f(true); } // ill-formed, no diagnostic required
909+
constexpr int f() { return f(true); } // ill-formed: no diagnostic required
910910

911911
struct B {
912912
constexpr B(int x) : i(0) { } // \tcode{x} is unused
@@ -916,7 +916,7 @@
916916
int global;
917917

918918
struct D : B {
919-
constexpr D() : B(global) { } // ill-formed, no diagnostic required
919+
constexpr D() : B(global) { } // ill-formed: no diagnostic required
920920
// lvalue-to-rvalue conversion on non-constant \tcode{global}
921921
};
922922
\end{codeblock}
@@ -1677,8 +1677,8 @@
16771677
body.
16781678
\begin{example}
16791679
\begin{codeblock}
1680-
auto f() { } // OK, return type is \tcode{void}
1681-
auto* g() { } // error, cannot deduce \tcode{auto*} from \tcode{void()}
1680+
auto f() { } // OK: return type is \tcode{void}
1681+
auto* g() { } // error: cannot deduce \tcode{auto*} from \tcode{void()}
16821682
\end{codeblock}
16831683
\end{example}
16841684

@@ -1690,14 +1690,14 @@
16901690
\tcode{return} statements.
16911691
\begin{example}
16921692
\begin{codeblock}
1693-
auto n = n; // error, \tcode{n}'s type is unknown
1693+
auto n = n; // error: \tcode{n}'s type is unknown
16941694
auto f();
1695-
void g() { &f; } // error, \tcode{f}'s return type is unknown
1695+
void g() { &f; } // error: \tcode{f}'s return type is unknown
16961696
auto sum(int i) {
16971697
if (i == 1)
16981698
return i; // \tcode{sum}'s return type is \tcode{int}
16991699
else
1700-
return sum(i-1)+i; // OK, \tcode{sum}'s return type has been deduced
1700+
return sum(i-1)+i; // OK: \tcode{sum}'s return type has been deduced
17011701
}
17021702
\end{codeblock}
17031703
\end{example}
@@ -1729,19 +1729,19 @@
17291729
auto f();
17301730
auto f() { return 42; } // return type is \tcode{int}
17311731
auto f(); // OK
1732-
int f(); // error, cannot be overloaded with \tcode{auto f()}
1733-
decltype(auto) f(); // error, \tcode{auto} and \tcode{decltype(auto)} don't match
1732+
int f(); // error: cannot be overloaded with \tcode{auto f()}
1733+
decltype(auto) f(); // error: \tcode{auto} and \tcode{decltype(auto)} don't match
17341734

17351735
template <typename T> auto g(T t) { return t; } // \#1
1736-
template auto g(int); // OK, return type is \tcode{int}
1737-
template char g(char); // error, no matching template
1738-
template<> auto g(double); // OK, forward declaration with unknown return type
1736+
template auto g(int); // OK: return type is \tcode{int}
1737+
template char g(char); // error: no matching template
1738+
template<> auto g(double); // OK: forward declaration with unknown return type
17391739

1740-
template <class T> T g(T t) { return t; } // OK, not functionally equivalent to \#1
1741-
template char g(char); // OK, now there is a matching template
1740+
template <class T> T g(T t) { return t; } // OK: not functionally equivalent to \#1
1741+
template char g(char); // OK: now there is a matching template
17421742
template auto g(float); // still matches \#1
17431743

1744-
void h() { return g(42); } // error, ambiguous
1744+
void h() { return g(42); } // error: ambiguous
17451745

17461746
template <typename T> struct A {
17471747
friend T frf(T);
@@ -1877,9 +1877,9 @@
18771877
auto x5a = f(); // \tcode{decltype(x5a)} is \tcode{int}
18781878
decltype(auto) x5d = f(); // \tcode{decltype(x5d)} is \tcode{int\&\&}
18791879
auto x6a = { 1, 2 }; // \tcode{decltype(x6a)} is \tcode{std::initializer_list<int>}
1880-
decltype(auto) x6d = { 1, 2 }; // error, \tcode{\{ 1, 2 \}} is not an expression
1880+
decltype(auto) x6d = { 1, 2 }; // error: \tcode{\{ 1, 2 \}} is not an expression
18811881
auto *x7a = &i; // \tcode{decltype(x7a)} is \tcode{int*}
1882-
decltype(auto)*x7d = &i; // error, declared type is not plain \tcode{decltype(auto)}
1882+
decltype(auto)*x7d = &i; // error: declared type is not plain \tcode{decltype(auto)}
18831883
\end{codeblock}
18841884
\end{example}
18851885

@@ -1915,9 +1915,9 @@
19151915
container(Iter b, Iter e) -> container<typename std::iterator_traits<Iter>::value_type>;
19161916
std::vector<double> v = { /* ... */};
19171917

1918-
container c(7); // OK, deduces \tcode{int} for \tcode{T}
1919-
auto d = container(v.begin(), v.end()); // OK, deduces \tcode{double} for \tcode{T}
1920-
container e{5, 6}; // error, \tcode{int} is not an iterator
1918+
container c(7); // OK: deduces \tcode{int} for \tcode{T}
1919+
auto d = container(v.begin(), v.end()); // OK: deduces \tcode{double} for \tcode{T}
1920+
container e{5, 6}; // error: \tcode{int} is not an iterator
19211921
\end{codeblock}
19221922
\end{example}
19231923

@@ -3195,7 +3195,7 @@
31953195
}
31963196
using namespace A::B::C;
31973197
void f1() {
3198-
i = 5; // OK, \tcode{C::i} visible in \tcode{B} and hides \tcode{A::i}
3198+
i = 5; // OK: \tcode{C::i} visible in \tcode{B} and hides \tcode{A::i}
31993199
}
32003200
}
32013201
namespace D {
@@ -3580,7 +3580,7 @@
35803580

35813581
namespace B {
35823582
extern "C" int f(); // \tcode{A::f} and \tcode{B::f} refer to the same function
3583-
extern "C" int g() { return 1; } // ill-formed, the function \tcode{g}
3583+
extern "C" int g() { return 1; } // ill-formed: the function \tcode{g}
35843584
// with C language linkage has two definitions
35853585
}
35863586

source/declarators.tex

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@
620620
or allow it to be changed through a cv-unqualified pointer later, for example:
621621

622622
\begin{codeblock}
623-
*ppc = &ci; // OK, but would make \tcode{p} point to \tcode{ci} ...
623+
*ppc = &ci; // OK: but would make \tcode{p} point to \tcode{ci} ...
624624
// ... because of previous error
625625
*p = 5; // clobber \tcode{ci}
626626
\end{codeblock}
@@ -1780,25 +1780,25 @@
17801780
\begin{example}
17811781

17821782
\begin{codeblock}
1783-
void g(int = 0, ...); // OK, ellipsis is not a parameter so it can follow
1783+
void g(int = 0, ...); // OK: ellipsis is not a parameter so it can follow
17841784
// a parameter with a default argument
17851785
void f(int, int);
17861786
void f(int, int = 7);
17871787
void h() {
1788-
f(3); // OK, calls \tcode{f(3, 7)}
1788+
f(3); // OK: calls \tcode{f(3, 7)}
17891789
void f(int = 1, int); // error: does not use default
17901790
// from surrounding scope
17911791
}
17921792
void m() {
17931793
void f(int, int); // has no defaults
17941794
f(4); // error: wrong number of arguments
17951795
void f(int, int = 5); // OK
1796-
f(4); // OK, calls \tcode{f(4, 5);}
1796+
f(4); // OK: calls \tcode{f(4, 5);}
17971797
void f(int, int = 5); // error: cannot redefine, even to
17981798
// same value
17991799
}
18001800
void n() {
1801-
f(6); // OK, calls \tcode{f(6, 7)}
1801+
f(6); // OK: calls \tcode{f(6, 7)}
18021802
}
18031803
\end{codeblock}
18041804
\end{example}
@@ -1929,7 +1929,7 @@
19291929
// used as default argument
19301930
typedef int I;
19311931
int g(float I, int b = I(2)); // error: parameter \tcode{I} found
1932-
int h(int a, int b = sizeof(a)); // OK, unevaluated operand
1932+
int h(int a, int b = sizeof(a)); // OK: unevaluated operand
19331933
\end{codeblock}
19341934
\end{example}
19351935
A non-static member shall not appear in a default argument unless it appears as
@@ -1969,7 +1969,7 @@
19691969

19701970
void h() {
19711971
int j = f(1);
1972-
int k = f(); // OK, means \tcode{f(0)}
1972+
int k = f(); // OK: means \tcode{f(0)}
19731973
}
19741974

19751975
int (*p1)(int) = &f;
@@ -2007,7 +2007,7 @@
20072007
void m() {
20082008
B* pb = new B;
20092009
A* pa = pb;
2010-
pa->f(); // OK, calls \tcode{pa->B::f(7)}
2010+
pa->f(); // OK: calls \tcode{pa->B::f(7)}
20112011
pb->f(); // error: wrong number of arguments for \tcode{B::f()}
20122012
}
20132013
\end{codeblock}
@@ -2268,7 +2268,7 @@
22682268

22692269
\begin{codeblock}
22702270
struct onlydouble {
2271-
onlydouble() = delete; // OK, but redundant
2271+
onlydouble() = delete; // OK: but redundant
22722272
onlydouble(std::intmax_t) = delete;
22732273
onlydouble(double);
22742274
};
@@ -2285,8 +2285,8 @@
22852285
void* operator new(std::size_t) = delete;
22862286
void* operator new[](std::size_t) = delete;
22872287
};
2288-
sometype* p = new sometype; // error, deleted class \tcode{operator new}
2289-
sometype* q = new sometype[3]; // error, deleted class \tcode{operator new[]}
2288+
sometype* p = new sometype; // error: deleted class \tcode{operator new}
2289+
sometype* q = new sometype[3]; // error: deleted class \tcode{operator new[]}
22902290
\end{codeblock}
22912291
\end{example}
22922292

@@ -2304,7 +2304,7 @@
23042304
~moveonly() = default;
23052305
};
23062306
moveonly* p;
2307-
moveonly q(*p); // error, deleted copy constructor
2307+
moveonly q(*p); // error: deleted copy constructor
23082308
\end{codeblock}
23092309
\end{example}
23102310

@@ -2734,7 +2734,7 @@
27342734
\begin{codeblock}
27352735
int f(bool b) {
27362736
unsigned char c;
2737-
unsigned char d = c; // OK, \tcode{d} has an indeterminate value
2737+
unsigned char d = c; // OK: \tcode{d} has an indeterminate value
27382738
int e = d; // undefined behavior
27392739
return b ? d : 0; // undefined behavior if \tcode{b} is \tcode{true}
27402740
}
@@ -4014,7 +4014,7 @@
40144014

40154015
struct A {
40164016
std::initializer_list<int> i4;
4017-
A() : i4{ 1, 2, 3 } {} // ill-formed, would create a dangling reference
4017+
A() : i4{ 1, 2, 3 } {} // ill-formed: would create a dangling reference
40184018
};
40194019
\end{codeblock}
40204020

@@ -4063,7 +4063,7 @@
40634063
int x = 999; // x is not a constant expression
40644064
const int y = 999;
40654065
const int z = 99;
4066-
char c1 = x; // OK, though it might narrow (in this case, it does narrow)
4066+
char c1 = x; // OK: though it might narrow (in this case, it does narrow)
40674067
char c2{x}; // error: might narrow
40684068
char c3{y}; // error: narrows (assuming \tcode{char} is 8 bits)
40694069
char c4{z}; // OK: no narrowing needed

source/derived.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@
414414
struct F: public D, public E { }; // S(x,F) = S(x,E)
415415
int main() {
416416
F f;
417-
f.x = 0; // OK, lookup finds \tcode{E::x}
417+
f.x = 0; // OK: lookup finds \tcode{E::x}
418418
}
419419
\end{codeblock}
420420

0 commit comments

Comments
 (0)