You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
В репозитории, на который вы дали ссылку, написано:
There are two main reasons for implementing a novel counter for the C preprocessor other than the built-in (and non-standard) COUNTER. The first reason is that COUNTER is not flexible: when two or more headers use it, the values that this yields are not predictable. The second and most important reason is that COUNTER is not reusable and gets increased every time it is invoked, making the storage of its yielded values within the preprocessor environment virtually impossible.
Это уже несколько причин его не стандартизировать.
Ничто не мешает сделать нечто что будет увеличиваться при его чтении, но на уровне компиляции. Типа std::source_location::counter() __COUNTER__ у многих компиляторов есть из коробки. Но в стандарте ничего подобного нет.
Стандартизировать макрос
__COUNTER__
Что бы не городить такое https://github.com/madmurphy/zen.h/blob/master/zen.h
Полезные ссылки:
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros
https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros
The text was updated successfully, but these errors were encountered: