
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.
35 lines
779 B
Plaintext
35 lines
779 B
Plaintext
== Why is this an issue?
|
|
|
|
When ``++sizeof++`` is used on a pointer, it returns the size of the pointer (4 or 8 bytes, depending on architecture and OS), not the size of the pointed-to memory area. Therefore, division of that value is not likely to yield what was intended.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
char* message = "hello world";
|
|
sizeof(message) / 4; // Noncompliant
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Remove this division of the result of "sizeof".
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 27 Jul 2015, 14:17:50 Ann Campbell wrote:
|
|
\[~massimo.paladin] I've upgraded this to Critical/bug. See what you think
|
|
|
|
endif::env-github,rspecator-view[]
|