comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Urgent question: malloc and ada...READ/NEW/FOLLOWUP
Date: 1998/04/26
Date: 1998-04-26T00:00:00+00:00	[thread overview]
Message-ID: <dewar.893642842@merv> (raw)
In-Reply-To: 6hvm8k$t3l$1@news.hal-pc.org


Jonathan says

<<How does the Ada compiler implemetor know what C compiler is used in
that "particular environment in which the compiler operates"?
Telepathy?  I realize that, in the case of GNAT, (you assume) that
compiler is going to be GCC and that the way that code is generated by
that compiler is necessarily well understood by the GNAT team, but that
information simply isn't available to the implementor in the general case.
>>

First of all, multiple C compilers per se is not a problem unless they
use incompatible data layouts or calling sequences. On most machines the
data layout and calling sequence is pretty much fixed, with more or less
official help from the official ABI.

If there is more than one C compiler, then the Ada compiler implementor
is expected to either specify what particular C compiler is to be used
or to provide multiple possible selections (e.g. by using diffent convention
names, as perhaps in 

	pragma Convention (Borland_C, ...);

In practice this has not proved necessary in any environment we have seen.
You make an assumption in the quoted paragraph above which is quite 
incorrect, namely that GNAT is tailored to what GCC does. This is the
wrong way of looking at things. In fact GNU C (that's actually what you
really mean by GCC here) goes to great efforts to be 100% compatible in
data layouts and calling sequences with whatever is the "standard" C
compiler in a given environment. Indeed it is regarded as a bug if GNU C
is not 100% compatible with the "standard" vendor compiler.

Thus the right way to look at things is that both GNU C, and GNAT (with
respect to pragma Convention C) make sure to be compatible with the standard
C compiler conventions.

As to the information not being available to the implementor, it can indeed
be tricky to find out what needs to be known, but it is not as difficult
as you might think, since on many machines the official ABI settles many
problems. In the case of GNU C, bug reports over the years have corrected
all the remaining minor discrepancies that have been discovered (remember
I said it was considered a bug if there are any discrepancies). This indeed
means that a lot of the critical work was already in place to meet the
GNAT requirement, but the requirement for GNAT is very definitely that it
must be compatible with the standard vendor C compiler (as well as GNU C).





  parent reply	other threads:[~1998-04-26  0:00 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-07  0:00 Urgent question: malloc and ada Guido Tesch
1998-04-09  0:00 ` Joe Gwinn
1998-04-10  0:00   ` Urgent question: malloc and ada...READ/NEW/FOLLOWUP Larry Kilgallen
1998-04-12  0:00     ` Joe Gwinn
1998-04-14  0:00       ` Robert Dewar
1998-04-16  0:00         ` Joe Gwinn
1998-04-17  0:00           ` Robert Dewar
1998-04-18  0:00             ` Joe Gwinn
1998-04-18  0:00               ` Robert Dewar
1998-04-25  0:00                 ` Joe Gwinn
1998-04-26  0:00                   ` Robert Dewar
1998-04-26  0:00                     ` Jonathan Guthrie
1998-04-26  0:00                       ` Simon Wright
1998-04-26  0:00                         ` Larry Kilgallen
1998-04-27  0:00                           ` Stephen Leake
1998-04-26  0:00                       ` Robert Dewar [this message]
1998-04-30  0:00                       ` Robert I. Eachus
1998-04-30  0:00                         ` Urgent question: malloc and ada Larry Kilgallen
1998-05-01  0:00                           ` Robert Dewar
1998-05-01  0:00                             ` Charles Hixson
1998-05-02  0:00                               ` Jonathan Guthrie
1998-05-02  0:00                             ` Corey Minyard
1998-05-06  0:00                             ` Robert I. Eachus
1998-05-12  0:00                               ` Craig T. Spannring
1998-05-12  0:00                                 ` Robert Dewar
     [not found]                           ` <matthew_heaney-ya023680003004981723000001@news.ni.net>
1998-05-01  0:00                             ` Robert Dewar
1998-05-01  0:00                               ` Larry Kilgallen
1998-05-02  0:00                                 ` Robert Dewar
1998-05-02  0:00                                   ` Jonathan Guthrie
1998-05-03  0:00                                     ` Robert Dewar
1998-05-03  0:00                                     ` Richard Kenner
1998-05-03  0:00                                       ` Jonathan Guthrie
1998-05-03  0:00                                         ` Richard Kenner
1998-05-03  0:00                                         ` Robert Dewar
1998-05-03  0:00                                   ` Larry Kilgallen
1998-05-01  0:00                       ` Urgent question: malloc and ada...READ/NEW/FOLLOWUP Fergus Henderson
1998-05-01  0:00                     ` Joe Gwinn
1998-05-02  0:00                       ` Larry Kilgallen
1998-05-05  0:00                       ` Robert Dewar
1998-04-10  0:00   ` Urgent question: malloc and ada Robert Dewar
1998-04-12  0:00     ` Joe Gwinn
1998-04-12  0:00       ` Enumeration Types (was: Urgent question: malloc and ada) Matthew Heaney
1998-04-13  0:00         ` Mark A Biggar
replies disabled

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