comp.lang.ada
 help / color / mirror / Atom feed
* Re: generic Integer for modular type bound
       [not found] <416fd34a$0$29515$636a15ce@news.free.fr>
@ 2004-10-15 16:00 ` Björn Persson
  2004-10-15 18:03 ` Jim Rogers
  1 sibling, 0 replies; 2+ messages in thread
From: Björn Persson @ 2004-10-15 16:00 UTC (permalink / raw)


Stany Marcel wrote:

> I tried to something like this:
> 
> generic
>     Size : Integer;
> 
> package MyGenPack
>     type MyType_T is mod Size;
> 
> but It doesn't works because Size is not static, so is there an other nice
> way to do this in Ada.

Maybe you can pass the type to the package?

generic
     type MyType_T is mod <>;
package MyGenPack

-- 
Björn Persson                              PGP key A88682FD
                    omb jor ers @sv ge.
                    r o.b n.p son eri nu




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

* Re: generic Integer for modular type bound
       [not found] <416fd34a$0$29515$636a15ce@news.free.fr>
  2004-10-15 16:00 ` generic Integer for modular type bound Björn Persson
@ 2004-10-15 18:03 ` Jim Rogers
  1 sibling, 0 replies; 2+ messages in thread
From: Jim Rogers @ 2004-10-15 18:03 UTC (permalink / raw)


Stany Marcel <marcel_s@epita.fr> wrote in message news:<416fd34a$0$29515$636a15ce@news.free.fr>...
> Hi,
> 
> I tried to something like this:
> 
> generic
>     Size : Integer;
> 
> package MyGenPack
>     type MyType_T is mod Size;
> 
> but It doesn't works because Size is not static, so is there an other nice
> way to do this in Ada.

Try the following:

generic
   MyType_T is mod <>;
package MyGenPack
 ....
end MyGenPack;

In other words, use a modular generic parameter rather than specifying
a size. You might want to study the different kinds of generic parameters
allowed by Ada. They are clearly defined in section 12.5 of the Ada
Reference Manual.

Jim Rogers



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

end of thread, other threads:[~2004-10-15 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <416fd34a$0$29515$636a15ce@news.free.fr>
2004-10-15 16:00 ` generic Integer for modular type bound Björn Persson
2004-10-15 18:03 ` Jim Rogers

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