42 lines
688 B
Plaintext
42 lines
688 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
if (($val = value()) && check()) { // Noncompliant
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
$val = value();
|
|
if ($val && check()) {
|
|
}
|
|
----
|
|
or
|
|
|
|
----
|
|
if ($val == value() && check()) { // Perhaps in fact the equality operator was expected
|
|
}
|
|
----
|
|
|
|
== Exceptions
|
|
|
|
Assignments in ``++while++`` statement conditions, and assignments enclosed in relational expressions are allowed.
|
|
|
|
----
|
|
while (($line = next_line()) != NULL) {...}
|
|
|
|
while ($line = next_line()) {...}
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::rspecator-view[]
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::rspecator-view[]
|