ip(6)_tables.h: return type difference in ip(6)t_get_target
Patrick Schaaf
bof at bof.de
Fri Sep 9 12:17:34 CEST 2005
> return (struct ip6t_entry_target *) ((void *)e + e->target_offset);
I'd write this as
return (struct ip6t_entry_target *) (((char *)e) + e->target_offset);
Two reasons:
First, cast to void* is a gcc C (and maybe C++, dunno) extension.
If you have to cast the result to the correct type, anyway, you
can as well use "char *".
Second, by putting "(char *)e" in an additional set of braces,
the reader of the code need not think about precedence of
cast vs. addition, i.e. the meaning of the construct is
more obvious.
best regards
Patrick
More information about the netfilter-devel
mailing list