lkml.org 
[lkml]   [1996]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 1.3.94 : if_arp.h
Jonathan Layes writes:
> On Apr 23, 1:24, Thomas Quinot <thomas@cuivre.fdn.fr> wrote:
> Subject: 1.3.94 : if_arp.h
> >It looks like if_arp.h lacks a #include (it uses MAX_ADDR_LEN from
> >netdevice.h).
>
> I'm getting a bit tired of writing in reply to this problem. Don't:
> #include <linux/netdevice.h>
> but instead just hard code the length of the hardware address field.
> If you include linux/netdevice.h, then lots of programs that use if_arp.h
> won't compile (especially c++ programs). So, please, don't do that. I'm
> sorry I ever used the constant MAX_ADDR_LEN, in if_arp.h; I should have
> just hard coded the length of the MAC address in the first place,
> like most of the other net header files do.

This sounds very bad to me.

If some programs can't include linux/netdevice.h, then
linux/netdevice.h maybe should be fixed.

Is the hardware address field supposed to be a device-specific
constant or a system-wide constant? Either way, it should be a
symbolic constant, not a magic number.

If it's a system-wide constant and including linux/netdevice.h is
impractical, then maybe there should be a new header file for
MAX_ADDR_LEN and other useful stuff.

Whatever, coding magic constants into structures like this is the road
to unmaintainability, and should be avoided at all costs.

-Matt


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.065 / U:1.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site