https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113341

--- Comment #14 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> This code gives me strict aliasing violation vibes:
> ```
> T **getAddressOfPointer(ExternalASTSource *Source) const {
>     // Ensure the integer is in pointer form.
>     (void)get(Source);
>     return reinterpret_cast<T**>(&Ptr);
>   }
> ```

A cast to void like that gives me very strong vibes, too, but of a "does this
person know C at all" kind.

Explicit casts are exceptionally useful, but they should be the exception.
They *should* stand out as something not normal.  Redundant useless silly casts
like this make code less readable, less clear.

Function results like this are implicitly ignored anyway.  Casting it to void
so it cannot be used is just silly, and that is a nice way of saying it.

</rant>

Reply via email to