comp.lang.ada
 help / color / mirror / Atom feed
From: dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner)
Subject: Re: More C
Date: 2000/01/28
Date: 2000-01-28T00:00:00+00:00	[thread overview]
Message-ID: <86skkc$9281@news.cis.okstate.edu> (raw)
In-Reply-To: 86rkj7$6re$1@clnews.edf.fr

On Fri, 28 Jan 2000 09:36:15 +0100, Pascal Obry <p.obry@der.edf.fr> wrote:
>David,
>
>The answer to your question was in the message you quoted!
>
>To know the number of colors use : Palette.Colors'Length (.all is
>not required here I think).
>
>You can also iterate through the table using:
>
>   for K in Palette.Colors'Range loop
>      ...
>   end loop;
>
>Did I missed something ?

We have a similar structure
struct bob {
   char num_chars_in_b;
   char *b; /* array */
};

In memory (assuming 8 bit pointers) we have

num_chars_in_b
|  pointer    array
|  |          |
03 20 ......  01 10 10 23 58 20 48 . . .

The only place in that memory where it tells you the length of the
array is num_chars_in_b. No matter how you translate that structure
into Ada, Ada can't give you the length of the array independent of
num_chars_in_b, because it doesn't have the information. Or so
I understand it.

-- 
David Starner - dstarner98@aasaa.ofe.org
If you wish to strive for peace of soul then believe; 
if you wish to be a devotee of truth, then inquire.
   -- Friedrich Nietzsche




  reply	other threads:[~2000-01-28  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <vhizotrc4x7.fsf@grotte.ifi.uio.no>
2000-01-28  0:00 ` More C tmoran
2000-01-28  0:00   ` David Starner
2000-01-28  0:00     ` Pascal Obry
2000-01-28  0:00       ` David Starner [this message]
2000-01-28  0:00         ` tmoran
2000-01-28  0:00 ` Gautier
2000-01-28  0:00 ` Jeff Carter
2000-01-30  0:00 ` Nick Roberts
     [not found]   ` <vhioga1r2j8.fsf@grotte.ifi.uio.no>
2000-02-01  0:00     ` tmoran
2000-02-02  0:00     ` Nick Roberts
2000-02-03  0:00     ` Keith Thompson
replies disabled

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