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_20,FREEMAIL_FROM, HELO_NO_DOMAIN,MAILING_LIST_MULTI,RDNS_NONE,REPLYTO_WITHOUT_TO_CC, SPOOFED_FREEMAIL_NO_RDNS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a64004e5f547b1ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-17 08:17:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "Gautier direct_replies_not_read" Newsgroups: comp.lang.ada Subject: Re: more to ada paper critic Date: Mon, 17 Jun 2002 15:16:57 +0000 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: avanie.enst.fr 1024327022 70832 137.194.161.2 (17 Jun 2002 15:17:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 17 Jun 2002 15:17:02 +0000 (UTC) Return-Path: X-Originating-IP: [194.40.39.20] X-OriginalArrivalTime: 17 Jun 2002 15:16:58.0644 (UTC) FILETIME=[060B9540:01C21612] Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:26158 Date: 2002-06-17T15:16:57+00:00 Immanuel Scholz: >Oh come. Arent there race conditions when initializing more than these >"before the main"s. This solution seems quite similar to C++'s problem >of initializing global statics. Example: (forgive any syntax-errors I >havent got GNAT to run until now ;-) >function Prob1 return integer is >begin > return Var2; >end Prob1; > >function Prob2 return integer is >begin > return Var1; >end Prob2; > >Var1 : constant integer := Prob1; >Var2 : constant integer := Prob2; This obviously don't pass the compilation, since Var1 and Var2 are undefined: this is the one-pass design of Ada (like Pascal, unlike C or Fortran) Anyway it is interesting to try. -- -- -- -- -- -- -- -- -- procedure kiki1 is function Prob1 return integer is begin return Var2; end Prob1; function Prob2 return integer is begin return Var1; end Prob2; Var1 : constant integer := Prob1; Var2 : constant integer := Prob2; begin null; end; -- -- -- -- -- -- -- -- -- GNAT says: kiki1.adb:5:12: "Var2" is undefined kiki1.adb:10:12: "Var1" is undefined If I push a bit more and "forward" the definition of Prob1, Prob2: -- -- -- -- -- -- -- -- -- procedure kiki2 is function Prob1 return integer; function Prob2 return integer; Var1 : constant integer := Prob1; Var2 : constant integer := Prob2; function Prob1 return integer is begin return Var2; end Prob1; function Prob2 return integer is begin return Var1; end Prob2; begin null; end; -- -- -- -- -- -- -- -- -- GNAT compiles, but says: kiki2.adb:6:30: warning: cannot call "Prob1" before body seen kiki2.adb:6:30: warning: Program_Error will be raised at run time kiki2.adb:7:30: warning: cannot call "Prob2" before body seen kiki2.adb:7:30: warning: Program_Error will be raised at run time Running kiki2 produces: raised PROGRAM_ERROR : kiki2.adb:6 ____________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/index.htm#Ada NB: For a direct answer, address on the Web site! _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx