From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,463c997594f91391 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Get_Immediate warning, (was: How to get a character?) Date: 1999/04/13 Message-ID: <7eva5j$npf$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 465836423 References: <370EE07D.67C71458@dave-world.net> <87k8vkag6f.fsf@bglbv.my-dejanews.com> <923936702.835.91@news.remarQ.com> <371304D4.81D40292@ddre.dk> X-Http-Proxy: 1.0 x13.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Apr 13 11:35:15 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-04-13T00:00:00+00:00 List-Id: In article <371304D4.81D40292@ddre.dk>, JS 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