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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2def9aa85afa5d22 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-30 08:26:45 PST Sender: sjw@galadriel.frlngtn.gecm.com Newsgroups: comp.lang.ada Subject: Re: Joint Strike Fighter References: <3BDCE159.39F6D422@adaworks.com> <11bf7180.0110290311.4d8d6f04@posting.google.com> <3BDF9C6A.C25520C5@adaworks.com> <3BE023AB.8F235EF5@sparc01.ftw.rsc.raytheon.com> <9rp8mo$6d8$1@nh.pace.co.uk> <11bf7180.0111010338.6dbc1537@posting.google.com> <9u5q9g$md$1@nh.pace.co.uk> From: Simon Wright Date: 30 Nov 2001 16:26:19 +0000 Message-ID: Organization: Alenia Marconi Systems, ISD, Farlington X-Newsreader: Gnus v5.5/Emacs 20.3 NNTP-Posting-Host: galadriel.frlngtn.gecm.com X-Trace: 30 Nov 2001 16:14:47 GMT, galadriel.frlngtn.gecm.com Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.cis.ohio-state.edu!news.maxwell.syr.edu!grolier!btnet-peer0!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!galadriel.frlngtn.gecm.com Xref: archiver1.google.com comp.lang.ada:17226 Date: 2001-11-30T16:26:19+00:00 List-Id: Ted Dennison writes: > If it took up more than a register I'd say you have a legitimate > gripe with your compiler vendor. However, you definitely should use > one of the forms gauranteed to pass by reference if you *need* it > passed that way for some reason. If you just want it to do the most > efficient thing (which is the ususal rationale I hear from the C > refugees), just let the compiler do it. This was the bug report: I have a (private) type Socket: type Socket is record Fd : Integer; -- -1 => socket is closed end record; and a procedure Close: procedure Close (The_Socket : in out Socket) is Fd : Integer; begin Fd := The_Socket.Fd; The_Socket.Fd := -1; -- indicate that The_Socket is now closed if Close (Fd) < 0 then -- this is an import of the Unix close() raise Close_Error; end if; end Close; GNAT uses copy semantics here, so if the exception occurs the actual parameter doesn't get altered and still has a valid file descriptor, leading to confusion downstream. so making Socket limited would have done as well (I can now see no reason why I shouldn't have done that .. this was a while back, may have been a reason at the time). Anyway, it really needed to be by reference! -- Simon Wright Email: simon.j.wright@amsjv.com Alenia Marconi Systems Voice: +44(0)23 9270 1778 Integrated Systems Division FAX: +44(0)23 9270 1800