comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Ada equivalent for C-pointer?
Date: Fri, 14 Jan 2005 14:05:04 -0600
Date: 2005-01-14T14:05:04-06:00	[thread overview]
Message-ID: <iqudncBsUsRtuHXcRVn-ug@comcast.com> (raw)
In-Reply-To: mailman.52.1105722023.527.comp.lang.ada@ada-france.org

>a System.Address is what you would expect a pointer to be: a (eg) 32 bit
>number referring to a memory address, like a C pointer.
  Wrong.
>Most access types
>will be the same size as, and equivalent to, a System.Address, but some
  Wrong.
There is no requirement that a System.Address have any particular
representation.  For instance, quoting from the manual for a compiler
that handles the general segment:offset form of addressing in
Intel 8086 descended chips:
  type Address is record
    Offset : Offset_Type;
    Segment: Word;
  end record;
which is 48 bits.

>some access types may be bigger ("fat pointers") because ...
 Right.  Two different access types may have two different
representations, and neither is necessarily the same as a C pointer.

>       pragma Convention (C, C_Pointer);
  Right.  In Ada, one asks the compiler to handle such low-level stuff,
rather than worrying about it or trying to sneakily do it yourself.
That's why there is a pragma Convention to tell the compiler you want
something to be compatible with C (or Fortran, or whatever).

  Separately, and probably irrelevantly for the OP, there is a
package System.Address_to_Access_Conversions to let you tell the
compiler to convert between whatever form it is using for a particular
access type, and whatever form it is using for a System.Address.



  reply	other threads:[~2005-01-14 20:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-14 16:41 Ada equivalent for C-pointer? Alfred Hilscher
2005-01-14 17:00 ` Duncan Sands
2005-01-14 20:05   ` tmoran [this message]
2005-01-15  5:00     ` Brian May
2005-01-14 22:33 ` Keith Thompson
2005-01-14 23:03   ` Stephen Leake
2005-01-15 15:51     ` Nick Roberts
2005-01-15 18:54       ` tmoran
2005-01-16  1:43         ` Keith Thompson
2005-01-17 21:35       ` Randy Brukardt
2005-01-15  9:09 ` Martin Krischik
2005-01-15 16:03 ` Nick Roberts
2005-01-15 16:27   ` Pascal Obry
2005-01-15 16:50     ` Nick Roberts
2005-01-15 17:11       ` Simon Wright
2005-01-15 18:46         ` Nick Roberts
2005-01-15 17:49       ` Pascal Obry
2005-01-16  8:44       ` Martin Krischik
2005-01-16  9:58         ` Pascal Obry
2005-01-16 11:07           ` Martin Krischik
2005-01-16  8:36     ` Martin Krischik
2005-01-16 15:01       ` Niklas Holsti
2005-01-16 16:02         ` Martin Krischik
2005-01-17 15:33           ` Niklas Holsti
2005-01-16 20:39         ` Nick Roberts
2005-01-17 21:38     ` Randy Brukardt
2005-01-17 21:45       ` Pascal Obry
2005-01-17 13:11 ` Alfred Hilscher
2005-01-18  7:31   ` 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