Strict aliasing rule strikes back

Andrey Pokrovskiy wonder.mice at gmail.com
Mon May 25 21:04:35 CEST 2015


> Ugh, it shouldn't, because that would be a phenomenally poor analogy

I was referring to using an inappropriate tool (obscurity / confuse
compilers) to address the original problem (security / silence the
warnings). Also in both cases you don't really achieve the end goal
(security / silence the warnings) while having some illusion that you
do :)


On Sat, May 23, 2015 at 3:58 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Fri, May 22, 2015 at 05:20:39PM -0700, Andrey Pokrovskiy <wonder.mice at gmail.com> wrote:
>> > the additional void * cast is there to confuse some compilers
>> > into not emitting a warning, but is generally not very effective.
>>
>> Reminds me of "security through obscurity".
>
> Ugh, it shouldn't, because that would be a phenomenally poor analogy
> - there is no loss nor gain from trying to avoid a compiler warning
> regarding correctness (the semantics of the code don't change due to the
> extra cast, the same is true for using extra ()'s to silence warnings),
> while using obscurity for security in fact disables your security.
>
> The analogy would hold if the extra cast would silence the compiler while
> also introducing or keeping an aliasing violation - you'd gain silence
> that makes you feel safe, but in fact it's completely unsafe.
>
> --
>                 The choice of a       Deliantra, the free code+content MORPG
>       -----==-     _GNU_              http://www.deliantra.net
>       ----==-- _       generation
>       ---==---(_)__  __ ____  __      Marc Lehmann
>       --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
>       -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list