[Mingw-users] gcc 8.2.0: missing _fileno() for c++11

Anton Shepelev anton****@gmail*****
Wed Jan 22 06:46:41 JST 2020


Keith Marshall to Anton Shepelev:

> > Have you an idea why, then, fileno() is not rejected on
> > Linux with -std=c++11?
>
> One can only speculate that GLIBC headers are less
> rigorous in their interpretation of STRICT_ANSI__;
> opinions may differ on this, but in mine, that's a defect
> in GLIBC.

You are right.  A maintainer of GCC has confirmed his
intention actually to disable the automatic activation of
_GNU_SOURCE for all the -std options, which will make their
build of GCC behave like yours already does!

> _fileno() is not implemented as a function, in Microsoft's
> C-runtime library; it is defined as a macro in <stdio.h>,
> (or <cstdio> for use in C++ code).  The following works
> (tested on Manjaro-Linux, with my own self-built MinGW
> cross-compiler, and run under Wine):
> [...]

Thank you very much for the work-around.  I have forwarded
it to the maintainers.  Now they have have to solutions to
choose from.

> #define _fileno(__F) ((__F)->_file)

So FILE is not a truly opaque type in MinGW -- interesting.



More information about the MinGW-Users mailing list