Re: The elpelele problem (was: Re: Sfront patches for Visual C)

From: Erik de Castro Lopo (erikd@zip.com.au)
Date: Wed Aug 25 1999 - 16:26:48 EDT


Richard Dobson wrote:
>
> I dunno, I eat my greens, go to college, read lots of books, and
> eventually I launch myself into the public domain pretending that I
> almost know what I am talking about, and announce with deep gravitas
> that Visual C++ has bugs.
>
> Well, maybe it does, but not this one. I wander around the code thinking
> of something else entirely, and I spot something in sfront.c that
> suddenly rings a forlorn bell of ashamed recognition. I type just one
> character into one line, recompile, and, Hey Presto, sfront accepts all
> of elpelele.mid, and creates a file that goes on to generate a splendid
> 46-point-something megabyte rendering of El Pelele that could only be
> improved by the full Bosendorfer sample set.
>
> The character in question is a 'b', and it went in this line of
> sfront.c:
>
> midifile = fopen(argv[i],"rb");
>
> This, of course, ensures the file is opened in binary mode, so that
> bytes which happen to be quasi-EOF don't throw the next best thing to
> the Millenium bug.
>
> What I now want to know, is why it works without the 'b' under all the
> other compilers, gcc included? Does the ANSI standard matter, anyway?

As I recall, ANSI allows the 'b' option. Implementations which don't
have a distinction between binary and text files should ignore it.

It certainly works with gcc on all the unices I've tried it with
(IRIX, Solaris, *BSD, unixware) as well as IRIX's own CC.

Erik

-- 
+-------------------------------------------------+
     Erik de Castro Lopo     erikd@zip.com.au
+-------------------------------------------------+
"A program invented (sic) by a Finnish computer hacker and handed out
free 
in 1991 cost investors in Microsoft $11 billion (£6.75 billion) this
week."
  -- Andrew Butcher in the UK's Sunday Times, Feb 20th, 1999



This archive was generated by hypermail 2b29 : Wed May 10 2000 - 12:15:28 EDT