emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling in mingw-ucrt runtime


From: Bruno Haible
Subject: Re: Compiling in mingw-ucrt runtime
Date: Sun, 25 Feb 2024 16:05:54 +0100

Eli Zaretskii wrote:
> > On native Windows, the value of errno, after fclose() fails, is undefined.
> > See here in the Gnulib documentation:
> > https://www.gnu.org/software/gnulib/manual/html_node/fclose.html
> > 
> > and here in the Microsoft documentation:
> > https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fclose-fcloseall
> > (it sets errno only if the argument was a NULL pointer).
> 
> Strange that they claim that, because their sources tell a different
> story, both for MSVCRT and for UCRT.  Or maybe your interpretation of
> what they say there is inaccurate?

Re MSVCRT: My reading of Vc7/crt/src/fclose.c is that it never sets errno.

Re UCRT: My reading of ucrt-10.0.10240.0/stdio/fclose.cpp
and 10.0.14393.0/ucrt/stdio/fclose.cpp
is that errno gets set to EINVAL if the stream argument is invalid,
and remains unchanged otherwise.

This is consistent with the two documentation pages that I cited.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]