Path: utzoo!utgpu!watmath!att!bellcore!rutgers!iuvax!purdue!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.lang.c
Subject: Re: ReadKey like Function in C
Message-ID: <10767@smoke.BRL.MIL>
Date: 17 Aug 89 15:51:15 GMT
References: <148@trigon.UUCP> <225800206@uxe.cso.uiuc.edu> <1677@crdgw1.crd.ge.com> <19095@mimsy.UUCP> <10746@smoke.BRL.MIL> <21372@cup.portal.com>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 35

In article <21372@cup.portal.com> Kevin_P_McCarty@cup.portal.com writes:
>Agreed, except that such an environment, with its canonicalized input,
>does not encompass every application.  Such an environment is not the
>only one for which C programs are written.

And neither is a direct keyboard reading one.  Therefore it would be
inappropriate for a universal standard to attempt to legislate either
behavior.

>Programming with kbhit() and getch() is programming for an embedded
>system, ...

While getchar() etc. are required only in a hosted environment.  A
hosted environment is supposed to provide a fairly cozy set of
capabilities.  Although input canonicalization is not specifically
required, it is the sort of thing that might be reasonably expected
in a hosted environment.

>It is mostly programmers writing applications suited for these
>rudimentary platforms who need kbhit() and getch().  They only need them
>for embedded system types of programs, not for any applications which
>have a hope of porting elsewhere.

That is what the C Standard calls a "freestanding" environment.  Since
freestanding environments vary much more widely than hosted ones, the
Standard attempts to constrain them as little as possible.  For those
that have keyboards, perhaps kbhit() and getch() would be useful things
for the implementation to provide.  It's not clear that a flight control
system should be burdened with them.

>I see no need to go beyond the current state of affairs.
>Just because they are useful for some kinds of programming is
>no reason to canonize them into the language for everybody.

Right on!