[Ns-developers] [ns3] logging proposal

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Tue Apr 15 13:56:38 PDT 2008


On Tue, 2008-04-15 at 21:49 +0100, Gustavo Carneiro wrote:

> 
> I am fine with your perl script, but I am thinking now that it is not
> at all clear that NS_LOG_PARAMS also outputs the function name,
> besides the parameters themselves, so the pairing of NS_LOG_PARAMS
> with NS_LOG_FUNCTION is an error that is bound to occur again.
> 
> My proposal would be to get rid of the old NS_LOG_FUNCTION and rename
> NS_LOG_PARAMS to NS_LOG_FUNCTION.  In this case NS_LOG_FUNCTION
> becomes a function-style macro, and lines like this:
> 
>     NS_LOG_FUNCTION;
> 
> need to become like this:
>  
>     NS_LOG_FUNCTION ();
> 
> But now NS_LOG_FUNCTION optionally accepts parameters:
> 
> NS_LOG_FUNCTION (this << that);

That is exactly what I would have done if it worked :/

The syntax NS_LOG_FUNCTION (); does not work if you define
NS_LOG_FUNCTION as:

#define NS_LOG_FUNCTION(parameters) \
 ...

The only option is to use variadic macros or, maybe:

#define NS_LOG_FUNCTION0() \
...

and, then:

#define NS_LOG_FUNCTION(parameters) \
 ...



regards,
Mathieu




More information about the Ns-developers mailing list