comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <yaldnif.w@blueyonder.co.uk>
Subject: Re: Interresting, possibly buggy behavior in GNAT generics w/ expression function.
Date: Fri, 29 Mar 2013 15:26:51 +0000
Date: 2013-03-29T15:26:51+00:00	[thread overview]
Message-ID: <CD7B633B.29568%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: 615039cc-f33b-486a-b242-2c87292271d6@googlegroups.com

On 29/03/2013 14:54, in article
615039cc-f33b-486a-b242-2c87292271d6@googlegroups.com, "Shark8"
<onewingedshark@gmail.com> wrote:

> On Friday, March 29, 2013 8:47:36 AM UTC-6, Simon Wright wrote:
>> Shark8 <onewingedshark@gmail.com> writes:
>> 
>> 
>> 
>>>     Function Image(Value : Positive) Return String is
>> 
>>>       ( --if Value not in positive then "" else
>> 
>>>         Units.Constant_Reference( Attribute_Units, Value ) );
>> 
>> 
>> 
>> Or, of course, Attribute_Units (Value) !
> 
> That doesn't work.
> That I'm pretty sure is a bug; in any case at least the [compile-time] error
> it gives is utterly useless:
> generic_attribute_set.ads:36:07: "" is undefined

Type resolution in conditional expressions by GNAT GPL 2012 is not all it
should be.  E.g. I had to make the second 0 into a qualified expression in:

   function XR (X : M.i04)
   return M.i64 is
   begin
      return (if X = 0 then M.i64'(0) else GR(X));
   end XR;

because GNAT could not otherwise deduce its intended type, even though GR(X)
is of type M.i64.

Further to bijou buglettes in Ada 2012 mode, I had to write this:

    for s in slice'Range loop
    exit when slice(s) = all_blanks_code;
       h := rotate_left(h, 2) + slice(s);
    end loop;
    
To avoid this:

    for s of slice loop
    exit when s = all_blanks_code;
              |
>>> warning: variable "s" is not modified in loop body
>>> warning: possible infinite loop

       h := rotate_left(h, 2) + s;
    end loop;

-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;





  reply	other threads:[~2013-03-29 15:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 17:34 Interresting, possibly buggy behavior in GNAT generics w/ expression function Shark8
2013-03-28 18:06 ` Simon Wright
2013-03-28 18:38   ` Shark8
2013-03-30  5:59     ` Stephen Leake
2013-03-30 14:20       ` Shark8
2013-03-29  7:45 ` Simon Wright
2013-03-29 12:27   ` Dmitry A. Kazakov
2013-03-29 14:45     ` Simon Wright
2013-03-29 16:21       ` Dmitry A. Kazakov
2013-03-29 16:43         ` Shark8
2013-03-29 17:43         ` Eryndlia Mavourneen
2013-03-29 17:45           ` Eryndlia Mavourneen
2013-03-29 18:38             ` Simon Wright
2013-03-30  0:56         ` Randy Brukardt
2013-03-30  9:24           ` Dmitry A. Kazakov
2013-04-02  0:52             ` Randy Brukardt
2013-04-02  8:51               ` Dmitry A. Kazakov
2013-04-02 21:59                 ` Randy Brukardt
2013-03-29 14:47   ` Shark8
2013-03-29 14:56     ` Shark8
2013-03-30  1:04   ` Randy Brukardt
2013-03-30  2:36     ` Shark8
2013-03-30 15:51     ` Simon Wright
2013-04-01 15:58     ` Adam Beneschan
2013-04-02  0:46       ` Randy Brukardt
2013-04-02  8:18         ` Simon Wright
2013-04-02 11:14         ` Stephen Leake
2013-04-02 22:00           ` Randy Brukardt
2013-04-02 23:01             ` Adam Beneschan
2013-04-04  0:08               ` Randy Brukardt
2013-03-29 14:47 ` Simon Wright
2013-03-29 14:54   ` Shark8
2013-03-29 15:26     ` Bill Findlay [this message]
2013-03-29 15:48     ` Simon Wright
replies disabled

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