Why does sequence iteration work in C macro?
When writing C macro, there is a trick called "sequence iteration". It looks like as follow: #define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__) #define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__ #define FUNCTION(name) void name(); #define FUNCTION_TABLE(seq) CAT(FUNCTION_TABLE_1 seq, _END) #define FUNCTION_TABLE_1(x) FUNCTION(x) FUNCTION_TABLE_2 #define FUNCTION_TABLE_2(x) FUNCTION(x) FUNCTION_TABLE_1 #define FUNCTION_TABLE_1_END #define FUNCTION_TABLE_2_END FUNCTION_TABLE((x) (y) (z) (e)) The sequence, i.e. the argument of FUCTION_TABLE, will be processed one by one. However, as far as I know, a token will not be expanded twice in the same scope. Because it is "painted blue". When FUNCTION_TABLE_2 is expanded, the macro FUNCTION_TABLE_1 has already been painted yet. Why is it still expanded?
Using deduced types in other function templates, argument
Trouble with Polygon in Stroustrup's PPP book
Is there a case missing in §8.5 p17 (semantics of initializers) of N3797?
Migrating from Boost to the Standard Library for C++11
Perfect-forwaring of the variadic template parameters of a struct
Force Program to Start As Root and Drop it later
Is the memory initialization/deletion so time-consuming?
Debugging CUDA - CudaUnknownError
Simple decoding program C++ [closed]
Qt Application Slowing Down
How to Set a Class Instance Name to a Variable (C++)
DirectX 11 Make a square.
DeleteTimerQueueTimer() access violation and/or deadlock [closed]
Can the number of parameters determined by templates in c++?
Handling hotkeys with modifiers
HippoMocks With weak_ptr