Web lists-archives.com

Re: CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts

On 6/10/2017 10:30 PM, Eric Blake wrote:
> On 06/10/2017 08:48 AM, cyg Simple wrote:
>> Uhm, 'wt' and 'wb' came from MS itself.
> Not quite. fopen(,"wb") comes from POSIX.  "wb" is probably a microsoft
> extension, but it is certainly not in POSIX nor in glibc.

I think it's a C standard so it should be in glibc.  It may be mentioned
in the POSIX standard as in support of the C standard.

>>  GNU GCC was adapted to allow it
> Huh? It's not whether the compiler allows it, but whether libc allows
> it.  ALL libc that are remotely close to POSIX compliant support
> fopen(,"wb"), but only Windows platforms (and NOT glibc) support
> fopen(,"wt").

Looking at http://www.cplusplus.com/reference/cstdio/fopen/ I see:

"If additional characters follow the sequence, the behavior depends on
the library implementation: some implementations may ignore additional
characters so that for example an additional "t" (sometimes used to
explicitly state a text file) is accepted."

There is also a lot of discussion about the topic at:


As for glibc, it will just ignore the extra character but it allows the
use of "wt"; it just means nothing to that C runtime library. It does
aide in portable code though.

As for me conflating GCC with a C runtime - please forgive my lapse in

cyg Simple

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple