There is a piece of code in Linux Device Driver 3rd edition:
#undef PDEBUG
/* undef it, just in case */
#ifdef SCULL_DEBUG
# ifdef __KERNEL__
/* This one if debugging is on, and kernel space */
#
define PDEBUG(fmt, args...) printk( KERN_DEBUG "scull: " fmt, ## args)
# else
/* This one for user space */
#
define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
# endif
#else
# define PDEBUG(fmt, args...) /* not debugging: nothing */
#endif
#undef PDEBUGG
#define PDEBUGG(fmt, args...) /* nothing: it's a placeholder */
I am confused about this code:
Code:
#
define PDEBUG(fmt, args...) printk( KERN_DEBUG "scull: " fmt, ## args)
my problem is, how did this happen? I know the use of "..." in function parameters, whilst I never thought it can be used in macro definitions.
Can anyone explain the grammar behind this?
Thanks in advance.