comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com
Subject: Re: simple question - how to emulate void * ?
Date: 1998/10/25
Date: 1998-10-25T00:00:00+00:00	[thread overview]
Message-ID: <710353$522$1@nnrp1.dejanews.com> (raw)
In-Reply-To: dale-2410982221230001@dale.ppp.cs.rmit.edu.au

In article <dale-2410982221230001@dale.ppp.cs.rmit.edu.au>,
  dale@cs.rmit.edu.au (Dale Stanbrough) wrote:

> You should also be careful of scaring people away. Many people want to
> know if they can do a task in a particular way, i replied that they
> could (I often get asked "can Ada call "system"?" - there is a hell of
> a lot of ignorance out there (well, amongst students at least, but I
> would imagine that exactly the same happens elsewhere). Showing people
> that yes, Ada can do it in exactly this way _is_ a useful thing to show.
>
> People can then walk away and say
>
>    "ok, so i can do all of those things that C can. Maybe it's not
>     so bad...".

Dale certainly has a point. On the other hand, if you end up sending a message
that Ada can do anything you can do in C, and do not emphasize the advantages
of Ada, then a reasonable reaction is "well if Ada can do anything that C can
do [and implicitly vice versa, since I haven't heard anything to the contrary]
I might as well stick with C".

So it is important to emphasize the Ada way of doing things. In general people
tend to ask how to do something in Ada and tell you the solution they already
figured out in some other language, rather than the original problem, which
probably has a better solution.

After all if you really want to write a program full of address arithmetic
and low level C-style mucking (as opposed to using these features only at
critical points where they are justified), then I think you indeed should
stick to C, there is no point in writing C-style code in Ada. Interestingly
the converse is not true, there *is* a point in writing Ada-style code in C.
If you know Ada, and then force yourself to do things in a stylized way in
Ada style, you can get some of the advantages of Ada in C, at least at a
readability level (however, note the use of the word "some" here!)

Tucker Taft claims that the Intermetrics front end, which is written in C,
follows such style rules, but since few people have seen these sources it
is hard for people to judge how well this was achieved.

My own feeling is that even if you do try to write C in a restricted, "nice"
style, and enforce this with tools (the enforcement is very important or long
term maintenance by C programmers not so committed to the stylistic decisions
of the original will ruin things), you still have something that is far short
of satisfactory.

One of the best decisions we made in the GNAT project was to implement the
front end and library entirely in Ada 95. Interestingly this was a decision
forced on us by Chris Anderson, as our project manager at DoD when then GNAT
project was at NYU. She couldn't justify spending their money on writing C
code. We had originally intended to migrate the original Ada-Ed front end
(written in C in the early 80's) to Ada 95, but I think we would never have
succeeded following that path. Indeed the GNAT project itself is one of those
anecdotal cases of C programmers being forced to use Ada, and pretty quickly
being VERY happy with the change :-)

We certainly regard it as an important strength that we write in Ada 95, and
we believe in our own tools for building our tools. It would of course be
nice to rewrite gcc in Ada 95, but as in many other circumstances, one cannot
justify a major rewrite effort of this kind just to change languages. Of
course if one could find the resources for a major reengineering effort for
the GCC backend at the same time, that would be interesting.

However, even though the GCC backend is in C, the strong capabilities for
interfacing Ada 95 and C make it very easy to marry the Ada 95 front end
with the C backend (indeed GNAT itself is a very nice example of the ease
of such mixed language programming with Ada 95!)

Robert Dewar
Ada Core Technologies

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1998-10-25  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-23  0:00 simple question - how to emulate void * ? Craig Allen
1998-10-23  0:00 ` Tom Moran
1998-10-23  0:00 ` Dale Stanbrough
1998-10-22  0:00   ` Hans Marqvardsen
1998-10-22  0:00   ` Hans Marqvardsen
1998-10-23  0:00     ` John McCabe
1998-10-23  0:00       ` Ed Falis
1998-10-23  0:00         ` dennison
1998-10-24  0:00           ` Joe Wisniewski
1998-10-25  0:00           ` dewar
1998-10-24  0:00         ` Dale Stanbrough
1998-10-24  0:00           ` Tucker Taft
1998-10-24  0:00           ` Robert A Duff
1998-10-23  0:00       ` dennison
1998-10-23  0:00   ` David C. Hoos, Sr.
1998-10-23  0:00   ` David C. Hoos, Sr.
1998-10-23  0:00 ` Jeff Carter
1998-10-24  0:00   ` Dale Stanbrough
1998-10-25  0:00     ` dewar [this message]
1998-11-05  0:00 ` Craig Allen
1998-11-06  0:00   ` Tom Moran
1998-11-06  0:00   ` Dale Stanbrough
1998-11-06  0:00     ` Matthew Heaney
1998-11-06  0:00       ` dewarr
replies disabled

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