This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: EOF character in parser


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]