elements and #define

Eddie Kohler eddietwo at cag.lcs.mit.edu
Fri Aug 4 01:31:44 EDT 2000


Please don't use #define in element headers unless you have to. There can
be big problems if a name #defined by one header is re#defined in another
header, or (worse) used as a variable. If at all possible, use 'static
const int's inside the class definition. If you must use #define, at least
add a unique prefix, like the element's name.

not #define BYTES 4

but class IPRateMonitor {
      ...
      static const int BYTES = 4;
    };

or  #define IPRATEMON_BYTES 4

love,
ed



More information about the click mailing list