From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ac6f6c30c45f808a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 14 Jan 2005 14:05:04 -0600 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Ada equivalent for C-pointer? References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Fri, 14 Jan 2005 14:05:04 -0600 NNTP-Posting-Host: 67.161.24.234 X-Trace: sv3-hWUylmqGgJzwsMhIZG5MyDuVEOAIPjQAIE2uvT8a/fPNFLEFgRMfPzomuzwQHenD32xUww3b2QoOoG7!DIpgeSOFgdHbUwgqgdGT4SQxghM2e2cqRQwHOi0ex235C1FmKPrTctbfrzku0w== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.22 Xref: g2news1.google.com comp.lang.ada:7779 Date: 2005-01-14T14:05:04-06:00 List-Id: >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.