comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-dejanews.com>
Subject: Re: Get_Immediate warning, (was: How to get a character?)
Date: 1999/04/13
Date: 1999-04-13T00:00:00+00:00	[thread overview]
Message-ID: <7eva5j$npf$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 371304D4.81D40292@ddre.dk

In article <371304D4.81D40292@ddre.dk>,
  JS <john.doe@ddre.dk> wrote:
> Since Get_Immediate is much less used,
> You can never be sure if it really works as it is
> supposed to until you have verified it yourself for the
> compiler at hand.
>
> One recent example is Object-Ada version 7.1.1 where it
> did not !

That's not the right point of view. The issue here is
one of implementation dependence, Remember the only formal
requirement for Get_Immediate is:

  10   Reads the next character, either control or
       graphic, from the specified File or the default
       input file.  Mode_Error is propagated
       if the mode of the file is not In_File.  End_Error
       is propagated if at the end of the file.  The
       current column, line and page numbers
       for the file are not affected.

Any implementation satisfying this is "working". Note that
the above definition has nothing to say about echoing or
line returns being needed or anything.

Most likely by "working", people are talking about
paragraph 23 in the same section, which talks about
keyboard devices, and not waiting for input, but that
whole section is Implementation Advice, not a requirement,
for the very good reason that it is hard to know what it
means in some environments.

Note that even para 23 does not make it clear whether or
not Get_Immediate echoes the input (some people want the
answer to be yes, some to be no, implementations differ,
probably the ARG should address that particular subissue).

Anyway the point is that when you use Get_Immediate you
are definitely in the implementation dependent arena and
you must consult annex M of your vendors documentation.

Presumably this documentation in Object Ada said that this
advice was not followed, so this is not a bug, merely an
implementation choice that you do not like.

The corresponding part of the GNAT Annex M documentation,
found in the GNAT reference manual, says that GNAT does
follow this advice, so at least you should not have to
wait for a line return.

As for having an irrational fear of Get_Immediate, you
should use this ONLY when you need this functionality,
if Skip_Line or Get_Line has the right semantics, this
is far preferable since it is non-implementation dependent.
If you really need Get_Immediate, then you need to use it
regardless of your fears, but carefully document your
expectations and requirements, and realize that this part
of your code may not be as portable as other parts.



-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-04-13  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-10  0:00 How to get a character? Ben Barth
1999-04-10  0:00 ` Matthew Heaney
1999-04-10  0:00   ` bglbv
1999-04-10  0:00     ` Matthew Heaney
1999-04-12  0:00       ` Fraser Wilson
1999-04-13  0:00         ` Get_Immediate warning, (was: How to get a character?) JS
1999-04-13  0:00           ` Robert Dewar [this message]
1999-04-13  0:00             ` bglbv
1999-04-14  0:00               ` Larry Kilgallen
1999-04-14  0:00               ` Robert Dewar
1999-04-14  0:00                 ` bglbv
1999-04-15  0:00                   ` Robert Dewar
1999-04-16  0:00                     ` Matthew Heaney
1999-04-16  0:00                       ` Robert Dewar
1999-04-18  0:00                         ` Jean-Pierre Rosen
1999-04-19  0:00                     ` Robert A Duff
1999-04-14  0:00             ` JS
1999-04-14  0:00               ` Robert Dewar
1999-04-19  0:00                 ` Robert A Duff
1999-04-10  0:00 ` How to get a character? David C. Hoos, Sr.
1999-04-12  0:00   ` Jeff Carter
1999-04-12  0:00     ` Larry Kilgallen
1999-04-12  0:00     ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox