comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: memory management
Date: 02 Jun 2005 13:05:21 -0400
Date: 2005-06-02T13:05:21-04:00	[thread overview]
Message-ID: <wcck6lczo32.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: d7n9do$gak$1@wsc10.lrz-muenchen.de

Thomas Maier-Komor <maierkom@lpr.no-spam.e-technik.tu-muenchen.de> writes:

> Robert A Duff wrote:
> > The same is true of pointers in C and C++ -- an implementation is free
> > to implement pointers as something other than a machine address.  In
> > fact, if a C compiler wishes to check array bounds, it pretty much *has*
> > to use fat pointers.  I know of one C compiler that did just that.  My
> > point is that "pointer" is not synonymous with "single machine address",
> > even in C.
> >
> 
> That's definetly an interesting implementation variant for the C
> language. Could you tell us, which compiler did this? Has this been
> documented anywhere?

No, sorry, but I can't remember the name of the company or the product.
I think they went out of business about 10 years ago.  Their compiler
was intended for testing -- detecting array indices out of bounds.

Here's how to do it: allocate one word of dope before each array,
to store the length of the array.  Represent each C pointer as
a fat pointer: pointer to the dope, and pointer to the array
element.  Treat non-array objects like one-element arrays.
Then on each pointer dereference, check that the element pointer is
between the start and end of the array.

Ada compilers can do all this *much* more efficiently.
Ada does not need fat pointers.  GNAT uses them, but
only in rare cases.

- Bob



  reply	other threads:[~2005-06-02 17:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-26  0:57 memory management alex goldman
2005-05-26  2:14 ` David C. Hoos, Sr.
2005-05-26 13:21   ` Steve
2005-05-26 18:40     ` alex goldman
2005-05-28  2:13       ` Steve
2005-05-28  5:19         ` Jeffrey Carter
2005-05-28 14:48           ` Steve
2005-05-26 18:47     ` Pascal Obry
2005-05-27 14:33   ` Martin Krischik
2005-05-26 12:10 ` Robert A Duff
2005-05-27 14:31   ` Martin Krischik
2005-05-28 11:44     ` Robert A Duff
2005-05-28 13:03       ` Simon Wright
2005-05-31 12:04         ` Robert A Duff
2005-06-02 15:42       ` Thomas Maier-Komor
2005-06-02 17:05         ` Robert A Duff [this message]
2005-06-03  1:41       ` Steve
2005-06-03 10:12         ` alex goldman
2005-06-13  4:01         ` Dave Thompson
  -- strict thread matches above, loose matches on Subject: below --
2005-04-19 20:30 Memory_Management Anh Vo
2005-04-19  1:39 Memory_Management Bini
2005-04-19  9:18 ` Memory_Management Duncan Sands
2005-04-20  1:06   ` Memory_Management Bini
replies disabled

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