comp.lang.ada
 help / color / mirror / Atom feed
* generic's and 'size... gnat bug?
@ 2000-03-10  0:00 Al Johnston
  2000-03-10  0:00 ` Al Johnston
  2000-03-14  0:00 ` Al Johnston
  0 siblings, 2 replies; 3+ messages in thread
From: Al Johnston @ 2000-03-10  0:00 UTC (permalink / raw)


I have some code that I am porting that looks like this
assume
   subtype foo_id is natural;

generic
    type foo_gentype is (<>);
package some_package  is
    procedure some_routine;
end some_package;

package body some_package is
    procedure some_routine is
        function to_footype is new
unchecked_conversion(foo_gentype,foo_id);
        my_foo_gentype : foo_gentype;
        my_foo_id : foo_id_type;
    begin
        my_foo_id := to_footype(my_foo_gentype)
    end some_routine;
end some_package;

which is inst'd as
    package my_foo_pkg is new some_package(foo_id_type);

My problem: compile warning pointing to the line above; but addressing
the unchecked_conversion between foo_gentype and foo_id.  it says
foo_gentype'size is 32 and foo_id_type'size is 31.  I have run across
the "fact" that a natural uses 31 bits in gnat(linux/x86), but why does
the compiler think/use the value of 32 for the generic type?

is a bug?  or is this a language "feature"

thanks.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: generic's and 'size... gnat bug?
  2000-03-10  0:00 generic's and 'size... gnat bug? Al Johnston
@ 2000-03-10  0:00 ` Al Johnston
  2000-03-14  0:00 ` Al Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Al Johnston @ 2000-03-10  0:00 UTC (permalink / raw)


> >   subtype foo_id is natural;
>                 ^^^^
> should it not be foo_id_type here?

My post had the above error in it;  It
was a typo in the email, not in the
real code.

thanks to unnamed nice guy for pointing this
out.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: generic's and 'size... gnat bug?
  2000-03-10  0:00 generic's and 'size... gnat bug? Al Johnston
  2000-03-10  0:00 ` Al Johnston
@ 2000-03-14  0:00 ` Al Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Al Johnston @ 2000-03-14  0:00 UTC (permalink / raw)



finally found the problem... It was me... gnat. of course, is fine.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-03-14  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-10  0:00 generic's and 'size... gnat bug? Al Johnston
2000-03-10  0:00 ` Al Johnston
2000-03-14  0:00 ` Al Johnston

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