On 2025-06-22 13:16, Bruno Haible via Gnulib discussion list wrote:

+#ifdef GCD_WORD_T
+/* Make sure that GCD_WORD_T is defined as a type.  */
+# include <stddef.h>
+# include <stdint.h>
+#else
+# define GCD_WORD_T unsigned long
+#endif

A  little bikeshedding (hope you don't mind)....

If the includer #defines GCD_WORD_T it should be the includer's responsibility to make sure the definition works, which means the #includes here are not needed.

Might want to mention in the gcd.h comments that different parts of an application must all use the same GCD_WORD_T. Also, that GCD_WORD_T must be an integer type (either signed or unsigned).

Why not default GCD_WORD_T to unsigned long long int? Existing usages will work and this will be less hassle (and likely less error-prone) for usages. Alternatively, use _Generic (if C) and/or sizeof (if not) to make gcd a macro that "just works" for arbitrary integer types.


Reply via email to