On Thu, Feb 11, 2010 at 11:27 AM, Patrick McHardy <kaber@xxxxxxxxx> wrote: > Alexey Dobriyan wrote: >>> -static inline int ebt_basic_match(struct ebt_entry *e, struct ethhdr *h, >>> - const struct net_device *in, const struct net_device *out) >>> +static inline int >>> +ebt_basic_match(const struct ebt_entry *e, const struct ethhdr *h, >>> + const struct net_device *in, const struct net_device *out) >> >> These const modifiers are pointless because compilers are smart enough >> to notice non-modifiability and generate the very same code in both cases. >> >> Nowadays, half of functions declarations in generic >> xtables/iptables/ip6tables/arptables >> code are littered with const which makes them pretty unpleasant to read. > > Well, the benefit is that the compiler can catch accidental modification > of data that is supposed to be constant. Did it ever? Realistically? >From what I see, const is used with string functions (to make string literals go to rodata) and with structures full of hooks (to make them go to rodata). >>> - struct ebt_entry *e = (struct ebt_entry *)chain->data; >>> + const struct ebt_entry *e = (struct ebt_entry *)chain->data; >> >> And such things are wrong (not second const). > > What's wrong about this? Should it be (const struct ebt_entry *)? -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html