This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada policy


Zack Weinberg wrote:

[It's debatable whether it's practical to write a large complex piece
of software in the C language as ISO-standardized, but at least it's
possible to do so in the /de facto/ standard language.]

My final note on this issue, I am really surprised that it is debatable for C whether it is practical to write large complex pieces of software in standard C. I guess things are worse than I thought if that's the case.

In Ada, it is most certainly practical to write completely portable
large complex applications in Ada, and we have several customers who
do this since their coding guidelines require such portability, and
indeed some of them are using more than one compiler in parallel.

But once again, although this is practical and possible, it is simply
not a design criterion for GNAT. Since we know we are being compiled
with GNAT we take advantage of its full features. If vendors of
proprietary compilers want to borrow some of our code, then they
can mess to make it work with their compilers.

Here's a specific example:

THere is a routine in Ada.Decimal that does high precision decimal
scaled division. Of course the body could be written in pure
Ada, but in GNAT you will find:

      procedure Divide
        (Dividend  : in Dividend_Type;
         Divisor   : in Divisor_Type;
         Quotient  : out Quotient_Type;
         Remainder : out Remainder_Type);

pragma Import (Intrinsic, Divide);

The Ada standard defines the convention Intrinsic, but it is implementation
dependent what intrinsics are provided. The effect is similar to a built-in
in GCC, and the result is to let the compiler generate direct efficient
code for this operation.

Now if Aonix wants to borrow our implementations of decimal (they did borrow
some code at least at one point to fill in things they had not bothered to
implement themselves), then they will find this won't compile. Too bad as
far as we are concerned, being able to compile with Aonix is not one of
our coding requirements :-)

P.S. I know this is a run-time example, but it's a simple one to explain,
and there are many similar examples throughout the compiler.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]