When I wrote these macros we had one platform where we still used
linux-2.4 and gcc-2.95.3 and with that old gcc your macro def would
mean you can't use DBG with only one argument, like DBG("some string\n");
since gcc-2.95 would leave the , after __func__ followed by the
closing ")". I didn't find a way with gcc-2.95 to make the format
string a separate macro argument (which I also wanted). OK, that's
history now and linux-2.6 needs gcc-3/4 anyway, so I will change this.
I use "do { ... } while(0)" only for statements, not for expressions.
But I could have used the && instead of ?: operator. I don't think
the "do { ... } while(0)" looks nicer or has any other advantage.
You mean the order or `msg' and `cf'? You want to switch them so that
the variable args follow immediately the format string? Might make
sense, OTOH we wanted to have the message as the first argument.
Ah, I didn't know print_hex_dump(). That looks nicer. But as Thomas
mentioned, we shouldn't convert these functions into macros.
urs
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html