Ethereal-dev: Re: [Ethereal-dev] new ICE dissector (second try)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Wed, 06 Oct 2004 10:53:19 -0700
Thomas Boehne wrote:

packet-icep.c uses variadic macros, which are (unfortunately) not
supported in MSVC6.

...or in, I suspect, a number of other C compilers used to compile Ethereal, although I think C99 includes them.

I ran into the same problem with my own dissector, and did not come up
with a nice solution so far. I am currently using macros such as
DEBUG0, DEBUG1, DEBUG2, ... depending on the number of arguments. Does
anybody have a better solution?

A solution I've seen people use is

	#define DBG(x)	printf x

		...

		DBG(("this is the %dth iteration\n", i));

although that doesn't work if you need to pass arguments other than the format string and arguments to the format string to the debugging routine (e.g., "fprintf()"), as you'd have to pass those arguments in every macro call.

Maybe a "don't use variadic macros" sould be included in
README.developer.

Yes, it should, which is why I just checked one in.