I just happened to stumble across the following question on stack overflow:
In
gatomic.c
of glib there are several function declarations that look like this:
gboolean
(g_atomic_int_compare_and_exchange_full) (gint *atomic,
gint oldval,
gint newval,
gint *preval)
{
return g_atomic_int_compare_and_exchange_full (atomic, oldval, newval, preval);
}
Where the OP of the question asks how this piece of code could work as it looks like a function that calls itself (it doesn't).
Why would anyone write code like this?
That is, defining a function with the exact same name as a macro.
Why not use two separate identifiers (or write the macro in ALL CAPS for that reason).
Possible answer: Why does the C library use macros and functions with same name? although this is about the C standard library, not some user library.