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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,13f10cac2d21b84f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-01 10:08:36 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: Is this a GNAT bug??? Date: 1 May 2002 10:08:35 -0700 Organization: http://groups.google.com/ Message-ID: <4519e058.0205010908.7ebc64fd@posting.google.com> References: <9gBz8.4053$451.2378814669@newssvr21.news.prodigy.com> NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1020272916 14801 127.0.0.1 (1 May 2002 17:08:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 May 2002 17:08:36 GMT Xref: archiver1.google.com comp.lang.ada:23353 Date: 2002-05-01T17:08:36+00:00 List-Id: robert_s_quinn@yahoo.com (Robert Quinn) wrote in message news:... > tmoran@acm.org wrote in message news:<9gBz8.4053$451.2378814669@newssvr21.news.prodigy.com>... > > This is not good Ada. [snip] There is no reason to > > assume an unchecked conversion from System.Address to an access > > type will work as you hope. ...unless your vendor docs say it will. It will render your code non-portable, but sometimes you might not care. Personally, I'd go for the portable way though. > Ahh, thanks for the note. I used the Unchecked_Conversion out of > ignorance and habit, since the system I actually work on uses it a > lot. Addresses are passed between tasks and then converted to an > appropriate access type. Or sometimes data is read off a socket, an > address passed to a task, then converted to an appropriate access > type. So I've seen this method used for both intertask communications > and for client-server communications. That was probably old Ada83 code. Folks did that stuff a lot in Ada83, as there was no other good way to get a pointer to a stack object. Today, we would use 'Access (or 'Unchecked_Access), and keep everything nice and type-safe. Passing addresess or accesses between tasks seems kinda dangerous. I don't know what their code did, so perhaps they carefully analyzed things, discovered that for some arcane reason this was the only way to pass their data, and made sure to access the contents safely. However, if I were a betting man, I'd be willing to wadger quite a bit that they did this because they stupidly thought Ada didn't pass parameters by reference (like older C doesn't), and that they have a race-condition in there. You certianly shouldn't clone such code yourself unless you really know what you are doing. -- T.E.D. Home - mailto:dennison@telepath.com (Yahoo: Ted_Dennison) Homepage - http://www.telepath.com/dennison/Ted/TED.html