
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
67 lines
1.2 KiB
Plaintext
67 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
It is possible to use the increment operator ``{plus}{plus}``, to set the value of a ``++bool++``({cpp}) or ``++_Bool++``+(C)+ variable to ``++true++``. But this feature has been deprecated in {cpp} since the 1998 version of the standard, removed in {cpp}17, and even where allowed, is simply confusing.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
bool alive;
|
|
...
|
|
alive++;
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,cpp]
|
|
----
|
|
bool alive;
|
|
...
|
|
alive = true;
|
|
----
|
|
|
|
|
|
== Resources
|
|
|
|
* ISO/IEC 14882:1998, 5.3.2
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Explicitly set 'XXX' to 'true'.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 20 Mar 2015, 22:12:13 Evgeny Mandrikov wrote:
|
|
Same is allowed in C, but seems that was not deprecated:
|
|
|
|
{noformat}
|
|
|
|
void fun() {
|
|
|
|
_Bool b = 0;
|
|
|
|
b{plus}{plus};
|
|
|
|
}
|
|
|
|
{noformat}
|
|
|
|
So [~freddy.mallet] could you please update spec? Also could you please add reference to exact version of standard about deprecation in order to not be unfounded?
|
|
|
|
=== on 6 Apr 2015, 12:40:59 Evgeny Mandrikov wrote:
|
|
\[~ann.campbell.2] description is about "{cpp}", whereas increment of boolean is allowed in C also.
|
|
|
|
endif::env-github,rspecator-view[]
|