Re: [Tinycc-devel] find a bug

2025-05-16 Thread Vincent Lefevre
On 2025-05-16 15:48:35 +0200, Charlie Gordon wrote: > On 16 May 2025, at 14:29, Vincent Lefevre wrote: > > This is portable because int64_t necessarily fits in a long long on > > any platform. > > This is correct, but only since C23. Previous versions of the C > Standard would have allowed `long

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
> On 16 May 2025, at 14:29, Vincent Lefevre wrote: > > On 2025-05-16 13:29:09 +0200, Charlie Gordon wrote: >> The correct portable way to print `int64_t` values is this: >> ``` >> #include >> #include >> #include >> >> int main(int argc, char **argv) { >> int64_t a =123, b = 234; >> prin

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
0; > } > output: > 123 0 > > > > -- 原始邮件 -- > 发件人: "avih" ; > 发送时间: 2025年5月16日(星期五) 下午5:38 > 收件人: "tinycc-devel"; > 抄送: "Sun"<809935...@qq.com>; > 主题: Re: [Tinycc-devel] find a bug > > I c

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
tf("%lu %lu\n",a,b); > > return 0; > } > output: > 123 0 > > > > -- 原始邮件 ---------- > 发件人: "avih" ; > 发送时间: 2025年5月16日(星期五) 下午5:38 > 收件人: "tinycc-devel"; > 抄送: "Sun"<809935...@qq.com>; > 主题: Re: [Tinycc

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Vincent Lefevre
On 2025-05-16 13:29:09 +0200, Charlie Gordon wrote: > The correct portable way to print `int64_t` values is this: > ``` > #include > #include > #include > > int main(int argc, char **argv) { >int64_t a =123, b = 234; >printf("%" PRId64 " %" PRId64 "\n", a, b); >return 0; > } > ```

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
a=123,b=234; > printf("%lu %lu\n",a,b); > > return 0; > } > output: > 123 0 > > > > -- 原始邮件 -- > 发件人: "avih" ; > 发送时间: 2025年5月16日(星期五) 下午5:38 > 收件人: "tinycc-devel"; > 抄送: "Sun"&l

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Charlie Gordon
rintf("%lu %lu\n",a,b); > > return 0; > } > output: > 123 0 > > > > -- 原始邮件 ------ > 发件人: "avih" ; > 发送时间: 2025年5月16日(星期五) 下午5:38 > 收件人: "tinycc-devel"; > 抄送: "Sun"<809935...@qq.com>; > 主题: Re: [Tin

Re: [Tinycc-devel] find a bug

2025-05-16 Thread Harald Arnesen via Tinycc-devel
Sun via Tinycc-devel [2025-05-16 11:03:50]: #include int main(int argc, char **argv) { int64_t a=111,b=222; printf("%d %d\n",a,b); return 0; } output: 111 0 On Linux, it prints "111 222". Need to include , or "int64_t" is undefined. -- Hilsen Harald __

Re: [Tinycc-devel] find a bug

2025-05-16 Thread avih via Tinycc-devel
I can confirm this output on Windows with mob f10ab130 (2025-03-28), but only with tcc 32 bit build. And, at least on Windows, it also needs #include However, this program is buggy, because the format %d is for int (32 bit on Windows), while the values are 64 bit, so a mismatch and undefined beh