[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master df58835 2/6: Never write files in "text"
From: |
Greg Chicares |
Subject: |
Re: [lmi] [lmi-commits] master df58835 2/6: Never write files in "text" mode: always use "binary" instead |
Date: |
Tue, 6 Dec 2016 12:52:26 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 |
On 2016-12-05 12:54, Vadim Zeitlin wrote:
> On Mon, 5 Dec 2016 06:55:44 +0000 (UTC) Greg Chicares <address@hidden> wrote:
[...]
> GC> Never write files in "text" mode: always use "binary" instead
> GC>
> GC> Otherwise, files written with msw can't be used with *nix.
[...]
> Wouldn't it be better to make our code accept and ignore "\r" before "\n"
> even under Unix?
There exists no fopen() mode that makes *nix programs ignore '\r',
so this would require extra code to be written everywhere a file is
opened. OTOH, specifying binary mode everywhere is easy--it's just
a standard argument to any file-open function, and no extra, custom
logic is needed.
And of course ftell() and fseek() can't be used with '\r\n'-delimited
files.
> While most MSW programs handle Unix EOLs correctly
> nowadays, some of them still don't
Even 'wordpad' does; 'notepad' is the only one I know that doesn't.
> so it seems user-unfriendly to generate
> the files that will mostly (almost exclusively, even) used under MSW in
> Unix format.
This particular commit affects rate-table text files, which are
intended for use by developers only; only the inscrutable binary
format will be distributed to end users.
For decades lmi has used '\n'-delimited files only. I'm convinced
that this was and remains the best policy--now more than ever,
because I'm developing on *nix only these days. And even more so
in the future, because lmi is likely to outlive msw and it will
always run well on *nix.