The HotSpot assert(), guarantee(), etc., macros require a message argument which is printed if the condition does not hold, e.g.:
assert(referent->is_oop(), "bad referent");
As currently implemented the message must be a string literal. It would be much more useful if multiple arguments could be used with format strings to provide more information, e.g.:
assert(referent->is_oop(), "bad referent %p", referent);
The easiest solution, variadic macros from C99, is not an option for HotSpot because they are not supported by Visual Studio 2003 which is used for Windows jdk6 builds.
Could instead use a c++ temporary object to format the arguments and return the result via an operator const char*. Sample usage would be:
assert(referent->is_oop(), err_msg("bad referent %p", referent));
where err_msg() constructs a temporary object with an internal buffer and formats the arguments. This allows existing, non-formatted asserts to remain unchanged and eliminates the need for numbered macros (assert1, assert2, etc.).