On Thu, May 16, 2002 at 08:55:27AM +0200, Harald Welte wrote:
> On Thu, May 16, 2002 at 03:15:11PM +0800, Fabrice MARIE wrote:
> > I probably didn't understand.. but is there any reason to
> > explicitely cast the pointer to become a 'void *'
> > when the declaration specifically says it is returning an 'ipt_entry_target
> > *' ?  Shouldn't it be casted to 'ipt_entry_target *' instead ?
> > Sorry if didn't understand, but I'm just curious.
> 
> It isn't about the return value, it's about the calculation.  Casting it to
> void * results in the addition of N bytes - otherwise we would add 
> sizeof(struct ipt_entry_target)*N

A cast to (char *) would work identically, and on a lot more compilers.
The usage shown is make-it-compile-with-gcc-only, with only a small
notational-purity benefit (it _is_ not a char, so why write that there?)

That's fine in the kernel, and fine in a userlevel system which is not
meant to be used as an open API, like the iptables internal stuff.

A more open iptables2 should not, in my opinion, contain such a void cast.

best regards
  Patrick

Reply via email to