On 2025-11-13 Pali Rohár wrote:
> On Thursday 13 November 2025 06:52:23 Kirill Makurin wrote:
> > With msvcr{100,110,120}.dll , `errno` is set to EINVAL when
> > entering main.  
> 
> It is a problem? I thought that errno value is undefined when entering
> into the main function.

In C99 and C17, section 7.5 paragraph 3 says that errno is zero at
program startup. It also says that library functions may set errno to a
non-zero value even on success if the use of errno isn't documented.
For example, in glibc older than 2.33 (2021), free() could set errno.

> It is up to the caller to set errno to 0 if caller wants to check it
> on possible success path.

Correct.

-- 
Lasse Collin


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to