This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: EOF character in parser
- From: DJ Delorie <dj at redhat dot com>
- To: wilson at specifixinc dot com
- Cc: gagneet at acmet dot com, gcc at gcc dot gnu dot org
- Date: Mon, 5 Jan 2004 20:15:28 -0500
- Subject: Re: EOF character in parser
- References: <1072501124.14935.ezmlm@gcc.gnu.org> <006a01c3cd48$55e00530$9900a8c0@GAGNEET> <3FFA0A09.8000104@specifixinc.com>
> This sounds like a C library problem. The C library should indicate
> end-of-file when it sees a 0x1a character. Gcc should not need to
> check for end-of-file characters, as it uses system calls like read
> that do it for us.
Note that gcc disables that functionality in libc, so it actually does
handle the 0x1a itself.
Note also that gcc normally uses mmap() to read the file, not read().
> If you have a broken system, then you could treat 0x1a as whitespace
> which should give the right result, as then the 0x1a character will
> be ignored.
On such "broken" systems, there are no rules about what follows the
0x1a. It used to be whatever garbage happened to be in the disk
buffers at the time that block was written, although these days the
file normally stops after the 0x1a. You *must* stop parsing at the
0x1a.