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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,74e0716429aeb760 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-10 06:33:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: Subject: Re: simple question just to be sure Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Wed, 10 Oct 2001 09:32:56 EDT Organization: http://www.newsranger.com Date: Wed, 10 Oct 2001 13:32:56 GMT Xref: archiver1.google.com comp.lang.ada:14148 Date: 2001-10-10T13:32:56+00:00 List-Id: In article , Rammeloo Stijn says... >According to me the following constructs are equivalent and are both >perfectly legal ada in ada83 and ada95: > > Bad_Frame_Name : constant String (1 .. 4) := "Bad" & Ascii.Nul; > > A_Nul : constant Character:= Ascii.Nul; > Bad_Frame_Name : constant String (1 .. 4) := "Bad" & A_Nul; > >Why do I ask? We use a code analyses tool that stumbles over the first >construct with the error message "Bad_Frame_Name Value length 5 does not >match object length 4" but not over the second one. According to me this is You may want to check package ASCII and verify that NUL isn't a 2-character string. If it isn't, then this message is clearly wrong. If it is a 2-character string, then the compiler is wrong. According to LRM J.5, it is supposed to be a constant character. >clearly a bug in the code analyses tool. According to the vendor, this 'odd' >behaviour would be caused by the fact that the first construct 'May not be >"perfect" Ada' but the second is. I totaly disagree with this statement. Can >some ada-guru out there confirm I'm right or, if not, why I'm wrong? Hopefully there's a bit of sense being lost in the translation here. It would be fair to say that this is not exactly proper form in Ada (even Ada 83). The declaration should not have the ranges on it, since those can be taken automaticly from the initilizing object, and you may want that object to change one day without having to recalculate the range. But that goes for *both* constructions. However, it is perfectly legal Ada. It could be that he meant to say that since you are doing something that isn't normally done (due to it not being proper form), you have stumbled upon a previously undiscovered bug in the compiler for handling that situation. That's perfectly reasonable, and happens all the time with all compilers. However, they should fix it. The fact that it seems to think one side of the object is 5 characters long is particularly worrysome. If you *hadn't* specified 4 characters, would it have made 5? What would be in the extra one? Yuck. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.