4158 shaares
128 private links
128 private links
2 results
tagged
define
Part1
#define FOO(x) do { foo(x); bar(x); } while (0)
if (condition)
FOO(x);
else
....
Part 2
do {
// do something
if (error) {
break;
}
// do something else
if (error) {
break;
}
// etc..
} while (0);
Utilisation d'une ellipse en macro C.
Exemple :
#define dbgprintf(...) realdbgprintf (FILE, LINE, __VA_ARGS)
dbgprintf ("Hello, world");
which expands to:
realdbgprintf (FILE, LINE__, "Hello, world");