Mail Archives: djgpp/2000/04/11/16:13:14
From: | Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Ansi/iso C compliance whatever it may eventually mean
|
Date: | 11 Apr 2000 12:45:54 GMT
|
Organization: | Aachen University of Technology (RWTH)
|
Lines: | 49
|
Message-ID: | <8cv6q2$il7$1@nets3.rz.RWTH-Aachen.DE>
|
References: | <002301bfa351$9c3bb3a0$2d9709ca AT saraswati>
|
NNTP-Posting-Host: | acp3bf.physik.rwth-aachen.de
|
X-Trace: | nets3.rz.RWTH-Aachen.DE 955457154 19111 137.226.32.75 (11 Apr 2000 12:45:54 GMT)
|
X-Complaints-To: | abuse AT rwth-aachen DOT de
|
NNTP-Posting-Date: | 11 Apr 2000 12:45:54 GMT
|
Originator: | broeker@
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Bharat Mallapur <bharatmallapur AT eth DOT net> wrote:
> in short i want to know that how is it that gcc which is supposed to be
> "totally" ansi/iso compliant not have getchar which is a standard library
> function.
getchar() is a library function, gcc is *only* the compiler, so it
certainly cannot provide getchar(). That's the job of the library
writers (DJ Delorie and the rest of us, in the case of DJGPP), not the
GCC authors.
> The use of getchar in K&R 2 and in many ansi compliant programs
> seems to be enough to call it ansi-compliant.
getchar() is an ANSI-standardized function. Your argument that seeing
something in lots of programs might make it ansi-compliant is
completely flawed, though. It's the standardization committee that
decides which functions are standardized, not the majority of
programs.
[...]
>>> My apologies if this is a wild goose chase.
I think it is one.
>>> On typing the 3 following lines when running the program:
>>> "a ^Z the" enter/return
>>> " ^Z the" enter/return
>>> "^Z the" enter/return
>>> 1) a leading EOF causes getchar() to behave properly
>>> 2) a non leading EOF causes getchar() to
>>> a) stop inputting characters
What's that supposed to mean, exactly. It'd have been more useful
if you had just shown the actual output of that program.
>>> b) ignore the EOF as seen by the non-triggering of the if-else
So what? What makes you think this is a bug in getchar()?
What causes and what does not cause EOF in a text stream is not
strictly defined, in DOS. IIRC, even DOS itself only treats ^Z at
the beginning of a line, as the very first character, as an EOF.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -