Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"##" in printk, what does ## mean

#define ext4_debug(f, a...)                     \
    do {                                \
        printk(KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:",    \
            __FILE__, __LINE__, __func__);          \
        printk(KERN_DEBUG f, ## a);             \
    } while (0)

what I dont understand is this

printk(KERN_DEBUG f, ## a); 

Could anybody help me to understand what is ## in this line? thank you

like image 800
Anders Lind Avatar asked Nov 05 '12 04:11

Anders Lind


People also ask

What do 2 quotation marks mean?

Use double quotation marks (“”) around a direct quote. A direct quote is a word- for-word report of what someone else said or wrote. You use the exact words and punctuation of the original. Harriet Jacobs writes, “She sat down, quivering in every limb” (61).

What is quotation mark used for?

The primary function of quotation marks is to set off and represent exact language (either spoken or written) that has come from somebody else. The quotation mark is also used to designate speech acts in fiction and sometimes poetry.

What is the 1 quotation mark called?

Single quotation marks are also known as 'quote marks', 'quotes', 'speech marks' or 'inverted commas'. Use them to: show direct speech and the quoted work of other writers.


1 Answers

Its a token for variadic macros(macros with multiple, variable arguments). Its gcc specific directive that allows 0 or more arguments as an input to, after f in ext4_debug(). Which means, f argument is mandatory, a may or maynot exist.

This is same as printf(const char *fmt,...) where, fmt is mandatory, other arguments are optional and dependent on the fmt. See the last statement in this doc: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

like image 134
Aniket Inge Avatar answered Sep 16 '22 13:09

Aniket Inge