comp.lang.ada
 help / color / mirror / Atom feed
From: reinert <reinkor@gmail.com>
Subject: Re: Strange warning message
Date: Mon, 27 Nov 2017 01:27:41 -0800 (PST)
Date: 2017-11-27T01:27:41-08:00	[thread overview]
Message-ID: <59cdbaed-63cd-48c9-8c68-994aae856123@googlegroups.com> (raw)
In-Reply-To: <0639dc1f-dfbb-4f4d-bd97-eb420dd3c046@googlegroups.com>

On Monday, November 27, 2017 at 10:09:15 AM UTC+1, gautier...@hotmail.com wrote:
> > Now, *in your example* the warning is justified, since you make a useless assignement :-) .
> 
> Ooops - didn't see you were starting a task in that case.
> But you could avoid using a pointer at all with
> 
>   declare
>     local : test1_t; 
>   begin
>     null;
>   end;
> 
> The only case I need an useless assignement is when I call a C function (for its side effects) and don't use the result.

As you see for this program (below), the task does not behave like "fire and forget". This was the intention for my use of "test1(1) := new test1_t;".

reinert


with Text_IO;
procedure test1l is

  task type test1_t;

  task body test1_t is
  begin
    Text_IO.Put_Line("Hello there!");
    delay 5.0;
  end test1_t;

begin

  declare
   test1 : test1_t;
  begin
   null;
  end;

  Text_IO.Put_Line(" Here we go ");

end test1l;


  reply	other threads:[~2017-11-27  9:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27  8:40 Strange warning message reinert
2017-11-27  9:00 ` Jacob Sparre Andersen
2017-11-27  9:13   ` reinert
2017-11-27  9:45     ` Jacob Sparre Andersen
2017-11-27 10:43       ` reinert
2017-11-27  9:01 ` gautier_niouzes
2017-11-27  9:09   ` gautier_niouzes
2017-11-27  9:27     ` reinert [this message]
2017-11-27 10:42 ` Jeffrey R. Carter
2017-11-27 10:47   ` reinert
2017-11-27 11:52     ` reinert
2017-11-29  0:43 ` Robert Eachus
2017-11-29 10:39   ` reinert
2017-11-29 20:47     ` Randy Brukardt
2017-11-30 14:11       ` reinert
2017-12-01 22:53     ` Robert Eachus
2017-12-02  8:47       ` Simon Wright
2017-12-02  9:47         ` Niklas Holsti
replies disabled

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