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,dae16e5441382930 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-07 15:40:06 PST Path: supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!howland.erols.net!newshub2.home.com!news.home.com!news1.sttls1.wa.home.com.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: Subject: Re: type mismatches/access type X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: <0Ezp6.524605$U46.15715798@news1.sttls1.wa.home.com> Date: Wed, 07 Mar 2001 23:38:36 GMT NNTP-Posting-Host: 24.20.66.55 X-Complaints-To: abuse@home.net X-Trace: news1.sttls1.wa.home.com 984008316 24.20.66.55 (Wed, 07 Mar 2001 15:38:36 PST) NNTP-Posting-Date: Wed, 07 Mar 2001 15:38:36 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:5527 Date: 2001-03-07T23:38:36+00:00 List-Id: Frank wrote in message news:wKxo6.7148$t21.173574@news3.oke.nextra.no... > Hi! > > I have downloaded the source code for the ADEPT projekt (on AdaPower > w-page). > There is a package that is a part of the "jxtrans" program > in there that I get a compilation error on, code snippet (of what I believe > is > important :-) follows: > The compiler is very frustrated by the use of the "=" operator and > Yes, and it doesn't like assignment either (and rightly so). [...] > > Is there some way to convince the compiler that Element can be "null"? Well, that's just it... Element can't be null! :-) Null does not exist for anonymous access types, such as defined by an access parameter. First of all: delete the if statements that deal with "if Element = null". They're meaningless and illegal, and there's no way to make them meaningful or legal, and they wouldn't do you any good if there were. The call to the subprogram involves an implicit conversion from the type of the actual parameter value to the anonymous type of the access parameter, so if you tried to pass a null access value as the actual parameter, the conversion will raise Constraint_Error (since null does not exist for the type you're converting to. Second: look at the places where you are assigning the value of an access parameter to an object of a named access type (I think something like "List.Head := Element" in your example). You need a conversion to make this legal, e.g. List.Head := Element_P (Element); or whatever. > after all,the package has compiled on Solaris... Thirdly: if you mean that you compiled it successfully, then take that compiler and throw it away! Fourthly: get rid of those annoying '('...')' around the expressions in the "if" statements. Hope this helps! Mark Lundquist Rational Software