[collectd] libperl and DEBUG macro (was: rc8 is not working)

Sebastian Harl sh at tokkee.org
Sat May 12 13:40:31 CEST 2007


On Sat, May 12, 2007 at 08:25:28AM +0200, Florian Forster wrote:
> On Wed, May 09, 2007 at 09:37:34PM +0200, Sebastian Harl wrote:
> > Flo, as DEBUG is a very generic name that might be used in a variety
> > of different locations it might make sense to rename the collectd
> > macros to something more specific. One the other hand, it should not
> > get too long, so something like C_DEBUG (think COLLECTD_DEBUG) or
> > LOG_DEBUG, etc. would imho be a good compromise. What do you think?
> I think this sucks. Generic names should be reserved to applications and
> should not be used in libraries :/

Well... I totally agree, but unfortunately we're not in an perfect world. Not
using generic names at all might avoid a lot of trouble.

> I'd prefer to stick with the `DEBUG' macro and code around this issue
> with something like this:
> -- 8< --
>  #include "plugin.h"
>  #define LOG_DEBUG DEBUG
>  #undef DEBUG
>  #include <perl.h>
> -- >8 --

This ain't gonna work. The compiler complains about undefined function "DEBUG"
in all places LOG_DEBUG is used (or uses the wrong definition from perl.h).

> -- 8< --
>  #include <perl.h>
>  #ifdef DEBUG
>  # undef DEBUG
>  #endif
>  #include "plugin.h"
> -- >8 --

This would be a (somewhat hacky) option...


Sebastian "tokkee" Harl
GnuPG-ID: 0x8501C7FC

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070512/3f87ee4f/attachment.pgp 

More information about the collectd mailing list