]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
_Generic.3: EXAMPLES: Allow taking a pointer to &my_imaxabs
authorAlex Colomar <alx.manpages@gmail.com>
Sat, 10 Sep 2022 21:28:15 +0000 (23:28 +0200)
committerAlex Colomar <alx.manpages@gmail.com>
Mon, 12 Sep 2022 14:16:03 +0000 (16:16 +0200)
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>
man3/_Generic.3

index f3daf98c1a87b77908549efc2efccaabda0e371a..87115e334d69dc360a16ec68bf7cc29e49af35f5 100644 (file)
@@ -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);
 }