On Fri, Aug 29, 2008 at 05:11:23PM +0200, Egon Eckert <[EMAIL PROTECTED]> wrote:
> sorry about introducing the ever-appearing aliasing-warnings theme :)...  Can
> someone, please, explain why *not* doing the cast in following macro
> definition:

not doing the cast accesses the "at" member of *ev (with unknown type, but
usually the type isn't ev_watcher_time), doing the cast accesses the at
member of the ev_watcher_time struct overlaying whatever ev's real type
is.

since all the remaining code also accesses the ev_watcher_time.at, leaving
out the cast allows the compiler to reorder code because can assume they
are not the same lvalues. (in practise, this doesn't happen between source
files yet, but it does happen within the same source file).

In c++, one could use an explicit static cast to typecheck, but not in C.
(in c++, of course, one could simply subclass...)

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [EMAIL PROTECTED]
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to