An ISO C commitee document contains a portability study regarding the
__COUNTER__ macro.


2025-04-07  Bruno Haible  <br...@clisp.org>

        verify: Enhance a comment.
        * lib/verify.h (_GL_COUNTER): Reference portability study regarding
        __COUNTER__.

diff --git a/lib/verify.h b/lib/verify.h
index 96fde0b9c8..3b01d7c2fb 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -157,9 +157,10 @@
 #define _GL_CONCAT0(x, y) x##y
 
 /* _GL_COUNTER is an integer, preferably one that changes each time we
-   use it.  Use __COUNTER__ if it works, falling back on __LINE__
-   otherwise.  __LINE__ isn't perfect, but it's better than a
-   constant.  */
+   use it.  Use __COUNTER__ if it works (it does so with most compilers,
+   see <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>),
+   falling back on __LINE__ otherwise.  __LINE__ isn't perfect, but it's
+   better than a constant.  */
 #if defined __COUNTER__ && __COUNTER__ != __COUNTER__
 # define _GL_COUNTER __COUNTER__
 #else




Reply via email to