Skip to content

Commit ef4899e

Browse files
committed
Prefer // OK: over // OK, ; // error: over // error, ; // error over // Error.
1 parent 2b7778c commit ef4899e

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
@@ -945,7 +945,7 @@
945945

946946
typedef int I;
947947
class D {
948-
typedef I I; // error, even though no reordering involved
948+
typedef I I; // error: even though no reordering involved
949949
};
950950
\end{codeblock}
951951
\end{example}
@@ -1782,7 +1782,7 @@
17821782
B::B() { }
17831783

17841784
B::A ba; // object of type \tcode{A}
1785-
A::A a; // error, \tcode{A::A} is not a type name
1785+
A::A a; // error: \tcode{A::A} is not a type name
17861786
struct A::A a2; // object of type \tcode{A}
17871787
\end{codeblock}
17881788
\end{example}
@@ -1978,7 +1978,7 @@
19781978
namespace C {
19791979
using namespace A;
19801980
using namespace B;
1981-
int i = C::x; // OK, \tcode{A::x} (of type \tcode{int} )
1981+
int i = C::x; // OK: \tcode{A::x} (of type \tcode{int} )
19821982
int j = C::y; // ambiguous, \tcode{A::y} or \tcode{B::y}
19831983
}
19841984
\end{codeblock}
@@ -2006,7 +2006,7 @@
20062006
}
20072007
using namespace B;
20082008
}
2009-
void A::f1(int){ } // ill-formed, \tcode{f1} is not a member of \tcode{A}
2009+
void A::f1(int){ } // ill-formed: \tcode{f1} is not a member of \tcode{A}
20102010
\end{codeblock}
20112011

20122012
\end{example} However, in such namespace member declarations, the
@@ -2029,7 +2029,7 @@
20292029

20302030
using namespace A;
20312031
using namespace C::D;
2032-
void B::f1(int){ } // OK, defines \tcode{A::B::f1(int)}
2032+
void B::f1(int){ } // OK: defines \tcode{A::B::f1(int)}
20332033
\end{codeblock}
20342034
\end{example}
20352035
\indextext{lookup!qualified~name|)}%
@@ -3380,7 +3380,7 @@
33803380
void B::mutate() {
33813381
new (this) D2; // reuses storage --- ends the lifetime of \tcode{*this}
33823382
f(); // undefined behavior
3383-
... = this; // OK, \tcode{this} points to valid memory
3383+
... = this; // OK: \tcode{this} points to valid memory
33843384
}
33853385

33863386
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
@@ -905,7 +905,7 @@
905905
\begin{codeblock}
906906
constexpr int f(bool b)
907907
{ return b ? throw 0 : 0; } // OK
908-
constexpr int f() { return f(true); } // ill-formed, no diagnostic required
908+
constexpr int f() { return f(true); } // ill-formed: no diagnostic required
909909

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

917917
struct D : B {
918-
constexpr D() : B(global) { } // ill-formed, no diagnostic required
918+
constexpr D() : B(global) { } // ill-formed: no diagnostic required
919919
// lvalue-to-rvalue conversion on non-constant \tcode{global}
920920
};
921921
\end{codeblock}
@@ -1683,8 +1683,8 @@
16831683
body.
16841684
\begin{example}
16851685
\begin{codeblock}
1686-
auto f() { } // OK, return type is \tcode{void}
1687-
auto* g() { } // error, cannot deduce \tcode{auto*} from \tcode{void()}
1686+
auto f() { } // OK: return type is \tcode{void}
1687+
auto* g() { } // error: cannot deduce \tcode{auto*} from \tcode{void()}
16881688
\end{codeblock}
16891689
\end{example}
16901690

@@ -1696,14 +1696,14 @@
16961696
\tcode{return} statements.
16971697
\begin{example}
16981698
\begin{codeblock}
1699-
auto n = n; // error, \tcode{n}'s type is unknown
1699+
auto n = n; // error: \tcode{n}'s type is unknown
17001700
auto f();
1701-
void g() { &f; } // error, \tcode{f}'s return type is unknown
1701+
void g() { &f; } // error: \tcode{f}'s return type is unknown
17021702
auto sum(int i) {
17031703
if (i == 1)
17041704
return i; // \tcode{sum}'s return type is \tcode{int}
17051705
else
1706-
return sum(i-1)+i; // OK, \tcode{sum}'s return type has been deduced
1706+
return sum(i-1)+i; // OK: \tcode{sum}'s return type has been deduced
17071707
}
17081708
\end{codeblock}
17091709
\end{example}
@@ -1735,19 +1735,19 @@
17351735
auto f();
17361736
auto f() { return 42; } // return type is \tcode{int}
17371737
auto f(); // OK
1738-
int f(); // error, cannot be overloaded with \tcode{auto f()}
1739-
decltype(auto) f(); // error, \tcode{auto} and \tcode{decltype(auto)} don't match
1738+
int f(); // error: cannot be overloaded with \tcode{auto f()}
1739+
decltype(auto) f(); // error: \tcode{auto} and \tcode{decltype(auto)} don't match
17401740

17411741
template <typename T> auto g(T t) { return t; } // \#1
1742-
template auto g(int); // OK, return type is \tcode{int}
1743-
template char g(char); // error, no matching template
1744-
template<> auto g(double); // OK, forward declaration with unknown return type
1742+
template auto g(int); // OK: return type is \tcode{int}
1743+
template char g(char); // error: no matching template
1744+
template<> auto g(double); // OK: forward declaration with unknown return type
17451745

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

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

17521752
template <typename T> struct A {
17531753
friend T frf(T);
@@ -1883,9 +1883,9 @@
18831883
auto x5a = f(); // \tcode{decltype(x5a)} is \tcode{int}
18841884
decltype(auto) x5d = f(); // \tcode{decltype(x5d)} is \tcode{int\&\&}
18851885
auto x6a = { 1, 2 }; // \tcode{decltype(x6a)} is \tcode{std::initializer_list<int>}
1886-
decltype(auto) x6d = { 1, 2 }; // error, \tcode{\{ 1, 2 \}} is not an expression
1886+
decltype(auto) x6d = { 1, 2 }; // error: \tcode{\{ 1, 2 \}} is not an expression
18871887
auto *x7a = &i; // \tcode{decltype(x7a)} is \tcode{int*}
1888-
decltype(auto)*x7d = &i; // error, declared type is not plain \tcode{decltype(auto)}
1888+
decltype(auto)*x7d = &i; // error: declared type is not plain \tcode{decltype(auto)}
18891889
\end{codeblock}
18901890
\end{example}
18911891

@@ -1921,9 +1921,9 @@
19211921
container(Iter b, Iter e) -> container<typename std::iterator_traits<Iter>::value_type>;
19221922
std::vector<double> v = { /* ... */};
19231923

1924-
container c(7); // OK, deduces \tcode{int} for \tcode{T}
1925-
auto d = container(v.begin(), v.end()); // OK, deduces \tcode{double} for \tcode{T}
1926-
container e{5, 6}; // error, \tcode{int} is not an iterator
1924+
container c(7); // OK: deduces \tcode{int} for \tcode{T}
1925+
auto d = container(v.begin(), v.end()); // OK: deduces \tcode{double} for \tcode{T}
1926+
container e{5, 6}; // error: \tcode{int} is not an iterator
19271927
\end{codeblock}
19281928
\end{example}
19291929

@@ -3164,7 +3164,7 @@
31643164
}
31653165
using namespace A::B::C;
31663166
void f1() {
3167-
i = 5; // OK, \tcode{C::i} visible in \tcode{B} and hides \tcode{A::i}
3167+
i = 5; // OK: \tcode{C::i} visible in \tcode{B} and hides \tcode{A::i}
31683168
}
31693169
}
31703170
namespace D {
@@ -3549,7 +3549,7 @@
35493549

35503550
namespace B {
35513551
extern "C" int f(); // \tcode{A::f} and \tcode{B::f} refer to the same function
3552-
extern "C" int g() { return 1; } // ill-formed, the function \tcode{g}
3552+
extern "C" int g() { return 1; } // ill-formed: the function \tcode{g}
35533553
// with C language linkage has two definitions
35543554
}
35553555

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}
@@ -1779,25 +1779,25 @@
17791779
\begin{example}
17801780

17811781
\begin{codeblock}
1782-
void g(int = 0, ...); // OK, ellipsis is not a parameter so it can follow
1782+
void g(int = 0, ...); // OK: ellipsis is not a parameter so it can follow
17831783
// a parameter with a default argument
17841784
void f(int, int);
17851785
void f(int, int = 7);
17861786
void h() {
1787-
f(3); // OK, calls \tcode{f(3, 7)}
1787+
f(3); // OK: calls \tcode{f(3, 7)}
17881788
void f(int = 1, int); // error: does not use default
17891789
// from surrounding scope
17901790
}
17911791
void m() {
17921792
void f(int, int); // has no defaults
17931793
f(4); // error: wrong number of arguments
17941794
void f(int, int = 5); // OK
1795-
f(4); // OK, calls \tcode{f(4, 5);}
1795+
f(4); // OK: calls \tcode{f(4, 5);}
17961796
void f(int, int = 5); // error: cannot redefine, even to
17971797
// same value
17981798
}
17991799
void n() {
1800-
f(6); // OK, calls \tcode{f(6, 7)}
1800+
f(6); // OK: calls \tcode{f(6, 7)}
18011801
}
18021802
\end{codeblock}
18031803
\end{example}
@@ -1928,7 +1928,7 @@
19281928
// used as default argument
19291929
typedef int I;
19301930
int g(float I, int b = I(2)); // error: parameter \tcode{I} found
1931-
int h(int a, int b = sizeof(a)); // OK, unevaluated operand
1931+
int h(int a, int b = sizeof(a)); // OK: unevaluated operand
19321932
\end{codeblock}
19331933
\end{example}
19341934
A non-static member shall not appear in a default argument unless it appears as
@@ -1968,7 +1968,7 @@
19681968

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

19741974
int (*p1)(int) = &f;
@@ -2006,7 +2006,7 @@
20062006
void m() {
20072007
B* pb = new B;
20082008
A* pa = pb;
2009-
pa->f(); // OK, calls \tcode{pa->B::f(7)}
2009+
pa->f(); // OK: calls \tcode{pa->B::f(7)}
20102010
pb->f(); // error: wrong number of arguments for \tcode{B::f()}
20112011
}
20122012
\end{codeblock}
@@ -2271,7 +2271,7 @@
22712271

22722272
\begin{codeblock}
22732273
struct onlydouble {
2274-
onlydouble() = delete; // OK, but redundant
2274+
onlydouble() = delete; // OK: but redundant
22752275
onlydouble(std::intmax_t) = delete;
22762276
onlydouble(double);
22772277
};
@@ -2288,8 +2288,8 @@
22882288
void* operator new(std::size_t) = delete;
22892289
void* operator new[](std::size_t) = delete;
22902290
};
2291-
sometype* p = new sometype; // error, deleted class \tcode{operator new}
2292-
sometype* q = new sometype[3]; // error, deleted class \tcode{operator new[]}
2291+
sometype* p = new sometype; // error: deleted class \tcode{operator new}
2292+
sometype* q = new sometype[3]; // error: deleted class \tcode{operator new[]}
22932293
\end{codeblock}
22942294
\end{example}
22952295

@@ -2307,7 +2307,7 @@
23072307
~moveonly() = default;
23082308
};
23092309
moveonly* p;
2310-
moveonly q(*p); // error, deleted copy constructor
2310+
moveonly q(*p); // error: deleted copy constructor
23112311
\end{codeblock}
23122312
\end{example}
23132313

@@ -2706,7 +2706,7 @@
27062706
\begin{codeblock}
27072707
int f(bool b) {
27082708
unsigned char c;
2709-
unsigned char d = c; // OK, \tcode{d} has an indeterminate value
2709+
unsigned char d = c; // OK: \tcode{d} has an indeterminate value
27102710
int e = d; // undefined behavior
27112711
return b ? d : 0; // undefined behavior if \tcode{b} is \tcode{true}
27122712
}
@@ -3967,7 +3967,7 @@
39673967

39683968
struct A {
39693969
std::initializer_list<int> i4;
3970-
A() : i4{ 1, 2, 3 } {} // ill-formed, would create a dangling reference
3970+
A() : i4{ 1, 2, 3 } {} // ill-formed: would create a dangling reference
39713971
};
39723972
\end{codeblock}
39733973

@@ -4016,7 +4016,7 @@
40164016
int x = 999; // x is not a constant expression
40174017
const int y = 999;
40184018
const int z = 99;
4019-
char c1 = x; // OK, though it might narrow (in this case, it does narrow)
4019+
char c1 = x; // OK: though it might narrow (in this case, it does narrow)
40204020
char c2{x}; // error: might narrow
40214021
char c3{y}; // error: narrows (assuming \tcode{char} is 8 bits)
40224022
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)