
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.
72 lines
1.5 KiB
Plaintext
72 lines
1.5 KiB
Plaintext
== Why is this an issue?
|
|
|
|
By contract, chaining the 'Address of' operator ``++&++`` with the 'Indirection' operator ``++*++`` results in a return to the initial value. Thus, such combinations are confusing at best, and bugs at worst.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
int *ptr = ...;
|
|
int *result1 = &(*ptr); //Noncompliant
|
|
int *result2 = &*ptr; //Noncompliant
|
|
|
|
int value = 4;
|
|
int result3 = *(&value); //Noncompliant
|
|
int result4 = *&value; //Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,cpp]
|
|
----
|
|
int *ptr = ...;
|
|
int *result1 = ptr;
|
|
int *result2 = ptr;
|
|
|
|
int value = 4;
|
|
int result3 = value;
|
|
int result4 = value;
|
|
----
|
|
|
|
|
|
=== Exceptions
|
|
|
|
No issue is raised when the ``++*++`` or ``++&++`` operators are overloaded or when both operators are not located in the same piece of code (one being generated by a macro expansion and the other one located in the main source code for instance).
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Remove this useless sequence of pointer operators: "xxx".
|
|
|
|
|
|
=== Highlighting
|
|
|
|
The sequence of pointer operators
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== relates to: S2761
|
|
|
|
=== on 19 Jan 2016, 11:08:48 Alban Auzeill wrote:
|
|
About the Labels: "bug"
|
|
|
|
I can't find one case where it can be a bug. In my view, it's more: brain-overload and perhaps performance
|
|
|
|
|
|
About "SQALE Characteristic": Reliability - Logic related reliability
|
|
|
|
In my view it's more: understandability or readability
|
|
|
|
endif::env-github,rspecator-view[]
|