summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Colomar <alx.manpages@gmail.com>2022-09-10 23:28:15 +0200
committerAlex Colomar <alx.manpages@gmail.com>2022-09-12 16:16:03 +0200
commita98bd8eb3033819b3a03e75c75c8bac4737e4ff4 (patch)
tree9da75364f7f13934609ddf3e061758518015e542
parentb0b6ab4e15df9abce3897775e866f6d9d3d5f18b (diff)
_Generic.3: EXAMPLES: Allow taking a pointer to &my_imaxabs
And show the pointer value in the example, and show also those of &labs and &llabs to compare. Cc: JeanHeyd Meneide <wg14@soasis.org> Cc: Florian Weimer <fweimer@redhat.com> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Ingo Schwarze <schwarze@openbsd.org> Signed-off-by: Alex Colomar <alx.manpages@gmail.com>
-rw-r--r--man3/_Generic.311
1 files changed, 7 insertions, 4 deletions
diff --git a/man3/_Generic.3 b/man3/_Generic.3
index f3daf98c1..87115e334 100644
--- a/man3/_Generic.3
+++ b/man3/_Generic.3
@@ -39,10 +39,10 @@ seamlessly upgrading to the widest available type.
#include <stdio.h>
#include <stdlib.h>
-#define my_imaxabs(j) _Generic(INTMAX_C(0), \e
- long: labs(j), \e
- long long: llabs(j) \e
- /* long long long: lllabs(j) */ \e
+#define my_imaxabs _Generic(INTMAX_C(0), \e
+ long: labs, \e
+ long long: llabs \e
+ /* long long long: lllabs */ \e
)
int
@@ -52,6 +52,9 @@ main(void)
a = \-42;
printf("imaxabs(%jd) == %jd\en", (intmax_t) a, my_imaxabs(a));
+ printf("&imaxabs == %p\en", &my_imaxabs);
+ printf("&labs == %p\en", &labs);
+ printf("&llabs == %p\en", &llabs);
exit(EXIT_SUCCESS);
}