comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: simple question just to be sure
Date: Wed, 10 Oct 2001 16:35:47 GMT
Date: 2001-10-10T16:35:47+00:00	[thread overview]
Message-ID: <3BC478E3.C269C992@boeing.com> (raw)
In-Reply-To: E472188161D5D311B08700105AF4CAAA04C99F35@kuumex03.barco.com

Rammeloo Stijn wrote:
> 
> Hello,
> 
> 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
> 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?

This appears to be an error in the analysis tool. Both expressions are
legal and equivalent. However,

Name : constant String := "Whatever" & ASCII.NUL;

is better for minimizing future errors when the software changes, and
should work around the analysis tool error as well.

-- 
Jeffrey Carter



      parent reply	other threads:[~2001-10-10 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-10  8:25 simple question just to be sure Rammeloo Stijn
2001-10-10 13:32 ` Ted Dennison
2001-10-13 23:40   ` R. Tim Coslet
2001-10-10 16:35 ` Jeffrey Carter [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox