comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com>
Subject: Re: Ada and embedded applications
Date: Mon, 4 Jun 2001 15:34:12 -0400
Date: 2001-06-04T19:34:14+00:00	[thread overview]
Message-ID: <9fgnrm$auh$1@nh.pace.co.uk> (raw)
In-Reply-To: LTQS6.29382$%_1.5022327@news2-win.server.ntlworld.com

Ada in general allows compilers to be creative about how they handle the
implementation of features to be as small and/or efficient as possible. For
example, GNAT has a version that restricts some features of the language in
order to be able to go to a "No Runtime" result. (Its called GNORT, in case
you want to do some searching for info on it.) You lose some features, but
can make code that doesn't depend on anything but what you provide. GNAT
itself is available for the cost of a download if you don't need support.
(Don't know for sure about GNORT.) So I don't think it ought to be a
budgetary issue. Many embedded projects are using GCC as their compiler -
GNAT isn't any different in how it can be used.

As for exceptions - the space/speed is going to vary depending on the
compiler. Again, there isn't anything in there that requires megabytes of
memory or huge processing overhead, but all compilers are different. I think
you'd find that whatever overhead is there that it isn't excessive - or even
the biggest ticket item on the list of features.

Think about it this way: Real-world embedded applications need to do a
variety of failure detection & accommodation things. You have to do checks
for math overflows, out of bounds references, out of memory conditions, etc.
etc. Ada provides you with exceptions which require some non-zero overhead
to deal with. C provides you with *nothing* and hence has no overhead. The
problem is that because you still need to check for error conditions, you're
going to have to do *something* on your own - thus creating more overhead.
It makes C look great for a while ("Look! No overhead!") until you realize
you've got all this extra code hanging around doing error processing of some
form. Usually, compiler generated stuff is going to end up more efficient in
the long run, especially for more mature compilers. Ada is really good for
applications that have a high reliability requirement specifically because
of all the checking it does (compile and run time) for error conditions. If
you think Ada is expensive, get a price quote on failure! :-)

With Ada, if you really need to, you can turn off the standard exceptions
and if you don't create any of your own, you should impose no additional
overhead on your program. C gives you no choice in the matter. You have to
be *very careful* when listening to C programmers talk about Ada because
usually they base their criticisms on a variety of rumors, FUD,
misinformation, etc., or a BAD experience with one particular compiler
developed 15 years ago. (Like getting a BAD meal in a restaurant - maybe it
was just one bad day for an otherwise good restaurant, but it left a bad
taste in your mouth and you never go back.)

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Chris Campbell" <chris.danx@ntlworld.com> wrote in message
news:LTQS6.29382$%_1.5022327@news2-win.server.ntlworld.com...
> Hi,
>
> On another group a discussion about various languages errupted and it took
a
> while to get anything positive out of it(it's started as the old "my
language is
> best" debate).  Now the discussion seems to be focussed on distance from
> hardware, like C being relatively close to hardware.  This is largely
irrelevant
> background.
>
> One poster claimed that Ada was not used in some embedded devices because
of
> memory overheads for exception handling.  Claiming it was used in embedded
> devices in industries that had budgets that supported it (e.g. the
aerospace
> industry).
>
>
> Is this correct or is it rubbish?  Also does exception handling in Ada
really
> have a large overhead?  (This is probably an implementation issue but is
their
> anything in the language that makes exception handling bulky?).
>
> I'm curious because one of the projects i'm working on involves writing an
OS.
> It's supposed to be as small as possible and i wouldn't want too many
overheads.
> (Also are exceptions dependant on platform? i.e. the mechanisms for
flagging an
> exception dependant on the OS?  If so the GNAT pragma No_Runtime would
eliminate
> this, but i'd have no exceptions to tell me if my code's buggered).
>
>
>
>
> Chris Campbell.
>
>





  reply	other threads:[~2001-06-04 19:34 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 18:59 Ada and embedded applications Chris Campbell
2001-06-04 19:34 ` Marin David Condic [this message]
2001-06-04 21:12   ` Chris Campbell
2001-06-04 21:33     ` Matthew Woodcraft
2001-06-04 21:33     ` Ted Dennison
2001-06-04 22:33       ` Chris Campbell
2001-06-05  7:55         ` Chris Campbell
2001-06-05 15:03           ` Ted Dennison
2001-06-04 22:09     ` Marin David Condic
2001-06-05  2:18       ` tmoran
2001-06-05 13:38         ` Marin David Condic
2001-06-06  4:09           ` Jeffrey Carter
2001-06-05 18:23         ` Randy Brukardt
2001-06-05 18:25         ` Randy Brukardt
2001-06-05 20:18           ` Marin David Condic
2001-06-05  7:45     ` Martin Dowie
2001-06-05 13:49       ` Marin David Condic
2001-06-05 20:47         ` Martin Dowie
2001-06-05 10:15     ` Rod Chapman
2001-06-04 21:02 ` Larry Kilgallen
2001-06-04 20:06   ` Ehud Lamm
2001-06-04 21:18     ` Ted Dennison
2001-06-05 12:35     ` Marc A. Criley
2001-06-05 19:00       ` Pascal Obry
2001-06-04 21:15 ` Robert A Duff
2001-06-04 21:30   ` Chris Campbell
2001-06-05  2:06     ` Jeffrey Carter
2001-06-05 14:04     ` Marin David Condic
2001-06-05  7:50 ` Martin Dowie
2001-06-05 14:24   ` John English
2001-06-08 23:55     ` Robert A Duff
2001-06-09 12:47       ` Ehud Lamm
2001-06-14 16:27       ` Pat Rogers
2001-06-06  2:31 ` Ken Garlington
2001-06-06 11:14   ` Chris Campbell
2001-06-06 15:47     ` Marin David Condic
2001-06-06 17:57     ` Jerry van Dijk
2001-06-06 22:32       ` Chris Campbell
2001-06-06 22:37         ` Chris Campbell
2001-06-06 15:42   ` Marin David Condic
replies disabled

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