comp.lang.ada
 help / color / mirror / Atom feed
From: "Davide" <ppp@ppp.it>
Subject: Re: data types & efficiency
Date: Fri, 5 Mar 2004 16:54:03 +0100
Date: 2004-03-05T16:54:03+01:00	[thread overview]
Message-ID: <c2a7qq$625$1@e3k.asi.ansaldo.it> (raw)
In-Reply-To: c9qg40l0lb2kqt9vi1q33s3c2s3gdcrtjl@jellix.jlfencey.com


>"Vinzent 'Gadget' Hoefler" wrote:

>Why? If you're interfacing to some external (hardware) interface you
>have to specify a certain size independent from the
>target-architecture, but if you don't need this I don't see why you
>should *have* to specify some size at all.

Well, requirements are to "redefine" the predefined types as Boolean,
Integerer, etc...
to enforce the indepence from compiler in terms of their internal
representation.
So I will define for example:

type UNSIGNED_INT_32_TYPE is range 0..(2**32)-1:
for  UNSIGNED_INT_32_TYPE'SIZE use 32;

to be used instead of the predefined Integer type.

One thing that I don't know is if I define:

subtype SMALLER_INT_TYPE is UNSIGNED_INT_32_TYPE range 0..150;

then, generally, the compiler can still optimize the representation in spite
of  the clause:
for  UNSIGNED_INT_32_TYPE'SIZE use 32;

?
What do you know about this?

Thanks.

P.S.:

My compiler's (Adamulti) manual is not clear about this. I made an
experiment with GNAT and it seems that it represents
SMALLER_INT_TYPE  as a byte. So this compiler still optimizes the subtype.
In this case your answer:

>3) Declare the type by specifying its range and let the compiler
>figure out what could be more efficient on the hardware.

would make sense also for my particular case.

I hope I've been clear...sorry for my bad english...and also please consider
I'm just beginning with Ada development.








  reply	other threads:[~2004-03-05 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05  8:02 data types & efficiency Davide
2004-03-05  9:23 ` Vinzent 'Gadget' Hoefler
2004-03-05  9:57   ` Davide
2004-03-05 12:00     ` Vinzent 'Gadget' Hoefler
2004-03-05 15:54       ` Davide [this message]
2004-03-05 20:53         ` tmoran
2004-03-08  9:28           ` Davide
2004-03-08  8:58         ` Vinzent 'Gadget' Hoefler
2004-03-08 10:53           ` Davide
2004-03-08 15:27           ` Robert I. Eachus
2004-03-05 10:22 ` Jean-Pierre Rosen
replies disabled

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