comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Compiler checking of String lengths during assignment (Newbie Question)
Date: Fri, 16 Jan 2015 07:28:58 +0000
Date: 2015-01-16T07:28:58+00:00	[thread overview]
Message-ID: <ly4mrrgp51.fsf@pushface.org> (raw)
In-Reply-To: m99f5h$hbf$2@dont-email.me

Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org> writes:

> On 01/15/2015 02:18 PM, Simon Wright wrote:
>> 
>> As I think I've said before, with the same compiler (on Mac OS X, but
>> I'd be _very_ surprised if that made a difference) I get warnings on
>> all three lines.
>
> You don't have the code the OP compiled, since he didn't post
> it. There's no telling what may appear between "begin" and the lines
> in question in that code.  As Duff showed, a null procedure call is
> enough to eliminate the warning on the line using I.

It was Adam, not Bob.

Adam showed that

   procedure Main is
      Head : String (1..5) := "XXX_N";
      i : Positive;
      Line : String := "12312312312312312";
      procedure Nothing is null;
   begin
      i := 2;
      Nothing;                   -- <<<<< prevents the 3rd warning 
      Head := "123";
      Head := Line(1 .. 2);
      Head := Line(i+2 .. i+4);
   end Main;

and, while I agree with you that the OP should have posted a compilable
example that demonstrated the problem, the posted code had nothing
between the assignment to i and the assignments to Head.


  reply	other threads:[~2015-01-16  7:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 22:50 Compiler checking of String lengths during assignment (Newbie Question) isaac1.0
2015-01-09 23:10 ` Simon Wright
2015-01-09 23:20   ` Stefan.Lucks
2015-01-10 12:43     ` Brian Drummond
2015-01-09 23:53 ` Shark8
2015-01-10  0:18 ` Jeffrey Carter
2015-01-10  1:48 ` Adam Beneschan
2015-01-10 10:03 ` Pascal Obry
2015-01-10 10:54 ` Simon Wright
2015-01-15 20:44 ` isaac1.0
2015-01-15 21:18   ` Simon Wright
2015-01-15 22:30     ` Jeffrey Carter
2015-01-15 22:32     ` Jeffrey Carter
2015-01-16  7:28       ` Simon Wright [this message]
2015-01-16 15:44         ` Jeffrey Carter
replies disabled

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