Author
anonymous
25 days ago
Language
C
Compiler
gcc 13.2.0
Options
Warnings
C99
no pedantic
Author
anonymous
25 days ago
$ gcc prog.c -Wall -Wextra -std=c99 In file included from prog.c:1:
prog.c: In function 'main':
yc_countof.h:9:28: error: static assertion failed: "yc_countof(): argument must be an array object, not a pointer"
9 | # define YC_STATIC_ASSERT _Static_assert
| ^~~~~~~~~~~~~~
yc_countof.h:21:26: note: in expansion of macro 'YC_STATIC_ASSERT'
21 | (0 * sizeof(struct { YC_STATIC_ASSERT((cond), msg); char _yc_static_assert_zero; }))
| ^~~~~~~~~~~~~~~~
yc_countof.h:35:6: note: in expansion of macro 'YC_STATIC_ASSERT_ZERO'
35 | (YC_STATIC_ASSERT_ZERO(!YC_IS_POINTER_OBJECT(a), \
| ^~~~~~~~~~~~~~~~~~~~~
prog.c:10:16: note: in expansion of macro 'yc_countof'
10 | enum { M = yc_countof(p) }; // ちゃんとコンパイルエラー
| ^~~~~~~~~~
yc_countof.h:37:16: warning: division 'sizeof (int *) / sizeof (int)' does not compute the number of array elements [-Wsizeof-pointer-div]
37 | sizeof(a) / sizeof((a)[0]))
| ^
prog.c:10:16: note: in expansion of macro 'yc_countof'
10 | enum { M = yc_countof(p) }; // ちゃんとコンパイルエラー
| ^~~~~~~~~~
prog.c:9:10: note: first 'sizeof' operand was declared here
9 | int *p = ar;
| ^
Exit Code:
1