rspec/rules/S2123/cfamily/rule.adoc

34 lines
450 B
Plaintext
Raw Normal View History

2020-06-30 12:48:07 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
int pickNumber() {
int i = 0;
int j = 0;
i = i++; // Noncompliant; i is still zero
return j++; // Noncompliant; 0 returned
}
----
== Compliant Solution
----
int pickNumber() {
int i = 0;
int j = 0;
i++;
return ++j;
}
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::rspecator-view[]