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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5af5c381381ac5a7 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!feeder.erje.net!eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada requires too much typing! Date: Thu, 10 Jun 2010 20:45:43 +0100 Organization: A noiseless patient Spider Message-ID: References: <876j8vF54kU1@mid.individual.net> <4c0e2af7$0$7659$9b4e6d93@newsspool1.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 10 Jun 2010 19:45:43 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="KCXegvZb5vh43D+f3BR6Ew"; logging-data="14214"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7OO0db6J+bW39YsLMZ4qs+igxelK945U=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin) Cancel-Lock: sha1:QWmyBXTdJlxRWKaj9OAj4SI0FmA= sha1:agz43bgWWa8BNZSZx/5VJEjZDHQ= Xref: g2news1.google.com comp.lang.ada:11610 Date: 2010-06-10T20:45:43+01:00 List-Id: Georg Bauhaus writes: > with Ada.Text_IO; use Ada.Text_IO; > > procedure Sttc is > > type T is range 0 .. 10; > > procedure A is > package P is > V: T; pragma Export (C, V, "naughty_v"); --<<<<<<<<<< > end P; > begin > if P.V'Valid then > P.V := P.V + 1; > else > P.V := T'First; > end if; > Put_Line (T'Image(P.V)); > end A; > > procedure Ovrwrt_Stk is > X : T; > begin > X := T'First; > end Ovrwrt_Stk; > > begin > A; Ovrwrt_Stk; A; Ovrwrt_Stk; A; Ovrwrt_Stk; A; > end Sttc; > > $ ./sttc > 0 > 1 > 1 > 1 > $ > > Phew. Back to normal. $ gnatmake sttc -f -gnatVa gcc -c -gnatVa sttc.adb sttc.adb:10:28: warning: "V" has been made static as a result of Export sttc.adb:10:28: warning: this usage is non-standard and non-portable gnatbind -x sttc.ali gnatlink sttc.ali $ ./sttc 1 2 3 4 (this is a GNAT-ism, of course, and is present in at least GNAT Pro 3.16a1 for powerpc-wrs-vxworks and GCC 4.5.0 for x86_64-apple-darwin10).