What does an empty # mean in a macro definition?

  • A+
Category:Languages

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?

 


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.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: