Search notes:

Preprocessor: Parantheses and commas

#define call(func, arg, cond) if (cond) { func(arg); }
#define COMMA ,

call(printf, "foo bar baz\n", true)
call(printf, "a = %d, b=%s\n" COMMA a COMMA b, get_flag("a" COMMA "b"))
call(printf, "d = %d, s=%s\n" COMMA (a+b)*2 COMMA get_val(1 COMMA 2), get_flag("a" COMMA "b") )
Github repository about-preprocessor, path: /macros/parantheses-and-commas/prog.c
After running this translation unit through gcc -E -P, it produces:
if (true) { printf("foo bar baz\n"); }
if (get_flag("a" , "b")) { printf("a = %d, b=%s\n" , a , b); }
if (get_flag("a" , "b")) { printf("d = %d, s=%s\n" , (a+b)*2 , get_val(1 , 2)); }

Makefile

prog.i: prog.c
	gcc -E -P $< -o $@
Github repository about-preprocessor, path: /macros/parantheses-and-commas/Makefile

See also

__VA_ARGS__

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:51 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(51): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(66): id_of(Object(PDO), 'uri', '/notes/developm...') #2 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759397103, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #3 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/C-C-plus-plus/preprocessor/macros/parantheses-and-commas(57): insert_webrequest() #4 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 51