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,9cb6352457d1c6de X-Google-Attributes: gid103376,public From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: is there a 'wait' command in Ada Date: 1996/12/01 Message-ID: <57smdo$9qv@felix.seas.gwu.edu>#1/1 X-Deja-AN: 201748192 references: <57qs45$d1l@felix.seas.gwu.edu> organization: George Washington University newsgroups: comp.lang.ada Date: 1996-12-01T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >michael feldman says > >"delay 1.0; > >will usually work. Compiler? Platform? Sometimes the behavior is a >bit unexpected, so more info will help us to help you." > >I don't get it, delay 1.0 must work on any implementation of Ada, what >do you have in mind here Mike? OK, you asked for it...:-) One would think that a simple delay followed by a Put would be platform- independently portable, but in this case the devil turns out to be in the details.:-) The delay will work, of course, but the poster's question was "how do I pause my program before displaying a message?" Exactly when the output will appear may be surprising. Sometimes a Flush is needed to force it to the screen, for example. Moreover, when running GNAT under GDB, including any tasking stuff causes surprising behavior (or no behavior at all), and delay is part of the tasking stuff in GNAT, etc., etc. I was quite interested by this question. Some (including Robert) have asserted that using delay just to pause an interactive program was not a very interesting idea. Evidently others think otherwise. I've argued that delay is a useful statement, completely independent of its RM introduction in the tasking chapter. Indeed, my book is crazy enough to use delay in several examples as a "pause" statement. This has turned out to be a bit of a thorn in my students' sides, because at GW, our intro courses run everything under GDB, which is hidden in a script to produce a nice traceback on an unhandled exception. GNAT, for better or worse, links in delay - even a simple delay in a non-tasking program - as part of the tasking runtime. Because of the unfriendly relations between tasking and GDB, programs that use simple delays don't work under our scripts. We've ended up writing a package called Sleep_Package, which exports a procedure Sleep that just uses a simple Unix sleep call. That works fine, but the students scratch their heads about why they have to change their code because the Ada in the book doesn't behave as advertised. Well, Robert, you asked the question, so I had to answer it.:-) Mike Feldman