I always write below code for debug purpose:
printf("%s:%d this is a string %s int %d",__FUNCTION__,__LINE__,strval,intval);
Now since the first part (FUNCTION,LINE) is always used, so I wish to create a macro to do it and just append other debug strings.
Maybe looks like:
#define MYPRINT(args...) printf("%s:%d",__FUNCTION__,__LINE__);printf(##args)
But I wish to use one statement rather than two as above! Is it possible?
Clarify not duplicate of this one
This is different because I wish to add some new field into print command. actually answers here is great, thanks for all's help!