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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,e0c2a51d337d44ce X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!kanaga.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: exit a program Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <7737506d-395c-441e-ab21-78cb2f7b2bfb@24g2000yqm.googlegroups.com> Date: Mon, 3 Aug 2009 11:45:22 +0200 Message-ID: NNTP-Posting-Date: 03 Aug 2009 11:45:22 CEST NNTP-Posting-Host: 691e0bf4.newsspool1.arcor-online.net X-Trace: DXC=oL:_fIbHl5\<<0iRN7DLEQic==]BZ:af^4Fo<]lROoRQ^YC2XCjHcbYCfe5QI_]=OYDNcfSJ;bb[UIRnRBaCdU_9dQ^Yc6B;kSIQh`^ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7537 Date: 2009-08-03T11:45:22+02:00 List-Id: On Mon, 3 Aug 2009 01:17:25 -0700 (PDT), Maciej Sobczak wrote: > On 2 Sie, 14:43, "Dmitry A. Kazakov" > wrote: > >>> is there an instruction that stops a program? >> >> No, because it is ill-defined. >> >> In order to define "stop of a program" consider what happens with the >> system resources allocated by the program (open files, shared libraries, >> sockets etc) > > Shared libraries and sockets are out of Ada scope. If you are using > them, then you apparently already know what you are doing. > > Files are in the scope and are handled (A.7/6): > > "The language does not define what happens to external files after the > completion of the main program and all the library tasks" > > I guess it is up to the implementation to fill this gap. > In other words, the concept of stopping the program is not ill- > defined... An implementation should implement something defined up front. >>> i need to stop a program and return to o.s. in case of an exception. >> >> Let it propagate out of the main task, that will terminate the program. > > and you even give instructions on how it can be done. ;-) No, I just give one possible way which effectively defines the semantics of stop in language terms. Robert gave two others: a call to OS (outside Ada, uncontrolled) and asynchronous transfer of control (dangerous in Ada). The problem with any implementation is that it might be different from what OP actually wants. This is why it is ill-defined. If you are debugging the program you need one type of stop, that freezes the current state as much as possible avoiding snow ball effects. If you are dealing with some persistent storage, you might want to roll back most of the side effects of program execution. In other cases you might wish to set a digital output to high causing a relay to break the power supply circuit of the computer. A distributed program is a totally different world. And so on and so forth. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de