This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [wwwdocs] gcc-8/changes.html additions
On Wed, 4 Apr 2018, Bernd Edlinger wrote:
> Is it OK for wwwdocs?
Yes, except...
+ <li><code>-Wsizeof-pointer-div</code> warns for suspicious divisions
+ of two <code>sizeof</code> expressions that divide the pointer size by
+ the element size, which is the usual way to compute the array size but
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ won't work out correctly with pointers.
...this is a bit misleading.
Dividing the pointer size by the element size is _not_ the usual way;
using the array size is. I am sure this is what you had in mind, just
the wording is a bit unfortunate. Perhaps "...which looks like the
usual way..." and "the size of a pointer" and "the size of elements
it points to"? And the sizeof expressions do not actually divide
anything.)
I seem to have a writer's block right now, or I would have proposed
a full alternative, but hope the above gives you an indication?
Definitely okay to commit the other parts of this patch, and let's
just work on this item a bit more.
Thanks,
Gerald