From 7294cb3edee0d8254f97df31cac5e5dce5ecfed2 Mon Sep 17 00:00:00 2001 From: prql-bot <107324867+prql-bot@users.noreply.github.com> Date: Sun, 19 Jul 2026 07:19:49 +0000 Subject: [PATCH] fix: use %zu/size_t for message count in C example `res.messages_len` is a `size_t`, but main.c printed it with `%ld` and iterated with an `int` loop counter. On LLP64 platforms (Windows x64) `long` is 32-bit while `size_t` is 64-bit, so the format specifier is a width/signedness mismatch (undefined behavior, can print a garbage count). Use `%zu` and a `size_t` counter, which are correct on every platform. --- prqlc/bindings/prqlc-c/examples/minimal-c/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prqlc/bindings/prqlc-c/examples/minimal-c/main.c b/prqlc/bindings/prqlc-c/examples/minimal-c/main.c index 66c6f00b5aa2..104cc7d7ec0b 100644 --- a/prqlc/bindings/prqlc-c/examples/minimal-c/main.c +++ b/prqlc/bindings/prqlc-c/examples/minimal-c/main.c @@ -3,8 +3,8 @@ #include void print_result(CompileResult res) { - printf("---- [ Compiled with %ld errors ]----\n", res.messages_len); - for (int i = 0; i < res.messages_len; i++) { + printf("---- [ Compiled with %zu errors ]----\n", res.messages_len); + for (size_t i = 0; i < res.messages_len; i++) { Message const *e = &res.messages[i]; if (e->display != NULL) { printf("%s", *e->display);