Strict aliasing rule strikes back

Marc Lehmann schmorp at schmorp.de
Fri May 22 13:48:13 CEST 2015


On Fri, May 22, 2015 at 01:14:57AM -0700, Andrey Pokrovskiy <wonder.mice at gmail.com> wrote:
> > so all accesss have to be against the ev_watcher struct, everywhere
> 
> So you are saying, that libev needs "(ev_watcher *)(void *)" cast
> exactly because it uses such cast (ev_watcher * type to be more
> precise) everywhere to access those members. And by uniformly

It needs the ev_watcher * cast, the additional void * cast is there to
confuse some compilers into not emitting a warning, but is generally not
very effective.

Otherwise, yes, the cast is so we access these members _always_ as
ev_watcher member, both inside libev, and in user code.

-- 
                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