13

I have the following macro:

#define F(Args, ...) \
   // macro definition
#
   F(()) // looks like usage?
#undef F

What does the line containing only # mean? Is F(()) a usage of the macro?

Boann
  • 48,794
  • 16
  • 117
  • 146
embedc
  • 1,485
  • 1
  • 6
  • 20

1 Answers1

19

Technically, that's not part of the macro (no continuation line before it). It's a directive that comes after the #define directive.

# on its own line is called a null directive and it does nothing (as good as a comment).

It's no longer practically useful (except as a visual marker) but in prehistoric C, the preprocessor only got invoked if a C source file started with a directive and the null directive placed at the very beginning of a C file was a good way to make sure the file was preprocessed (i.e., that later directives worked) without starting with a concrete directive.

Petr Skocik
  • 58,047
  • 6
  • 95
  • 142