Re: gcc 8.2.0: missing _fileno() for c++11

Keith Marshall <[email protected]> Mon, 20 Jan 2020 20:47:31 +0000
Newsgroups gmane.comp.gnu.mingw.user
Organization MinGW.org Project
Message-ID <[email protected]>
On 20/01/2020 20:22, Anton Shepelev wrote:
> Eli Zaretskii:
>> Doesn't -std=c++11 request strict ANSI C++?  _fileno is
>> non-ANSI, and thus isn't visible in a strict-ANSI
>> compilation.  I suggest to try the option -std=gnu++11
>> instead.
> 
> But you are right -- why should one expect a non-standard
> function or macro in a standard header if MinGW is not
> obliged to implement POSIX?  On the other hand, this worked
> with GCC 4.*...

GCC-4.x with what options?  Eli is 100% correct — -std=c++11 turns on
strict ANSI, (or more correctly ISO-C++), conformance checking, and
since fileno() is a POSIX.1 extension to ISO-C, (and _fileno() is a
Microsoft specific equivalent extension), if you request strict
ISO-C/ISO-C++ conformance checking, then either will be rightfully rejected.

> Since the project I am trying to build and contribute to is
> configured not to use the GNU extensions, I have to find
> another way of acessing fileno/_fileno.

But you are *already* depending on extensions, w.r.t. the standard of
conformance which you are demanding.  If you want extensions, whether
they be GNU or Microsoft, (or MinGW), don't specify "-std=c++11".  Why
do you need to do so, anyway?  GCC-8 compiles C++11 code by default,
without requiring *any* "-std=..." restriction.

> May I link it in manually from the MinGW library in which it *is* 
> implemented?

Of course.  You will get it from the default C-runtime library, but you
will need to explicitly declare it yourself.

> Or may I, perhaps, ask to to implement fileno as a favour?
No.  Either don't specify strict standards conformance checking, for a
standard which you are violating anyway, or provide your own extended
API declarations.

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEwZ7AGBVH3lDh1I9TwK02xjR+Wj8FAl4mEeMACgkQwK02xjR+
Wj+9ShAAxGD2N/YoUgmFQhjaniTwQr0zsaNkAIPAcHVQ+gLUOxntTK3uxih+nwwb
kpSkPPVVDrvw3gQjnVbsDJkUKYIsnIjR4ioIuCYQ2HE3pIoRn+oSgvYcE63x9b68
n6s+QnCbHj8aogyT2NzTBqXyZYGIbEUeSwXjc/qdPpwDFFZBSfk1lns5n5tmZtCL
JWQTj67pAuiYMIwLtyK7GSr8ZByjOvBoy6AqJAM76g2DUu0AAWTt8TBpW/2xMWXf
GBAWbu/Mflpq+35uthYLEl0tlhtH1Xgl6ARVrpZ+U74bWRihTGkIx24xMsjwtaal
tLxPx/IZwBs7CnqAS4PbrBlEGs4qt9uXZxJAevLsorilcwBMtoD5qp02bk7B086Z
FEOLX0gQVEeZ+wTGHfuKOVR4aFms3kn1jk2cnm+Yjjz0fALjEH6CYJQ0QsWHVTtZ
HcT2HVsbqTxCf1WlNQfjQL3t0iV9BEzJWqvYE1PKXg3npO8ct9fy7qNTvR1wYhS9
6YXMB6XQ4aDvL4qgtnqfZ5wW6vakaa9QQqzZio66Hl8F67jnWZNughKTPXT4wCNH
fwSUeb0Rz+ujhhfENpB0f82jSMk40REZJupVrbN1D0W69YBU8PrRtyqgFLWcq7WA
cy+ra2nMarhm1z0xqrfsJ65G/Te2XC0QNa+p+jMRycl+vXKH6Uk=
=5dX9
-----END PGP SIGNATURE-----