M
Mark
I have a piece of code having these lines:
#define ET_ERROR(args) fprintf(args)
....
ET_ERROR(("bus %d slot %d", bus, slot)); /* XX */
This causes compilation warnings:
warning: left-hand operand of comma expression has no effect
warning: passing argument 1 of 'printf' makes pointer from integer without a
cast
Obviously the second is the consequence of the first. As Im understand the
compiler treats expression found in parentheses of printf as a comma
operator. Is there any way to make it work, except changing a number of
arguments to macro, as there are lots of such macros scattered around the
code?
#define ET_ERROR(args) fprintf(args)
....
ET_ERROR(("bus %d slot %d", bus, slot)); /* XX */
This causes compilation warnings:
warning: left-hand operand of comma expression has no effect
warning: passing argument 1 of 'printf' makes pointer from integer without a
cast
Obviously the second is the consequence of the first. As Im understand the
compiler treats expression found in parentheses of printf as a comma
operator. Is there any way to make it work, except changing a number of
arguments to macro, as there are lots of such macros scattered around the
code?