don’t use z length modifier with unsigned int
GCC and Clang print warnings:
$ clang main.c -Wall
main.c:30:23: warning: format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'unsigned int' [-Wformat]
30 | printf("#%zu:\n", i);
| ~~~ ^
| %u
1 warning generated.
$ gcc main.c -Wall
main.c: In function ‘main’:
main.c:30:16: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 2 has type ‘unsigned int’ [-Wformat=]
30 | printf("#%zu:\n", i);
| ~~^ ~
| | |
| | unsigned int
| long unsigned int
| %u
Signed-off-by: Arkadiusz Drabczyk
---
man/man3/regex.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/man3/regex.3 b/man/man3/regex.3
index 3069489cb..a094c3b20 100644
--- a/man/man3/regex.3
+++ b/man/man3/regex.3
@@ -392,7 +392,7 @@ int main(void)
\&
off = pmatch[0].rm_so + (s \- str);
len = pmatch[0].rm_eo \- pmatch[0].rm_so;
- printf("#%zu:\[rs]n", i);
+ printf("#%u:\[rs]n", i);
printf("offset = %jd; length = %jd\[rs]n", (intmax_t) off,
(intmax_t) len);
printf("substring = \[rs]"%.*s\[rs]"\[rs]n", len, s + pmatch[0].rm_so);
--
2.45.2
Read more here: Source link
