![]() ![]() If you use Visual C++ you will need to add some workaround (like PP_EXPAND in the first post) to overcome VC++ preprocessor bug, see for details. Thought it is not as useful as min/ max ones. You can easily implement the same macros with other functionality and increase maximum number of arguments, for example sum: #define _SUM(A, B) ((A)+(B)) ![]() ![]() Now it is clearly seen how arguments number "counted" and how it works. The _START will then expand to _ARGS_3 and the following expansions are trivial. The arguments number is obtained by adding 4, 3, 2, 1 arguments invoking _START macro: #define min(.) _START(MIN, _VA_ARGS_, 4, 3, 2, 1) _START will expand to one of the _ARGS_1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |