comp.lang.ada
 help / color / mirror / Atom feed
From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe)
Subject: Re: Ada is almost useless in embedded systems
Date: 1996/02/21
Date: 1996-02-21T00:00:00+00:00	[thread overview]
Message-ID: <4gechc$g26@goanna.cs.rmit.EDU.AU> (raw)
In-Reply-To: 824760880.18193@assen.demon.co.uk

john@assen.demon.co.uk (John McCabe) writes:
>I honestly believed that I would receive intelligent responses
>explaining all the good features of Ada for embedded systems but I was
>obviously a bit naive.

With all due respect, it is a mystery to me how anyone could have expected
a posting whose title is
	"Ada is almost useless..."
to be perceived as anything other than flame bait.  When the first thing you
say is, in effect, "I know you have nothing worthwhile to tell me", you have
no right to be surprised if you fail to receive the response you expected.

>1) Strong Typing is also very good if you have a large system with a
>large number of programmers. Obviously it is advisable to catch errors
>as early as possible as the later you find them, the more expensive
>they tend to be to find. Also I have seen an article on 'lint' and its
>usage and there are some very good points in it related to the fact
>that it gives a lot of detail about trivial errors which can lead to
>the user unintentionally ignoring the serious errors!

In defence of Lint, I have to say that all of the things it reports are
likely symptoms of serious errors, and that it is next door to impossible
to UNINTENTIONALLY ignore the serious errors.  The only way you can ignore
the serious errors is by not tracking down all the lint reports to see how
serious they are.  A typical experience with someone else's code might be
	- 16 000 lines of source code
	-  1 000 lines of lint warnings
	-     10 hours checking the lint warnings
	-     10 days fixing the serious bugs.
Many categories of warnings can easily be switched off.

There are two real problems with lint.
(1) The declarations of C do not provide enough information for really
    effective checking.  (E.g. all integer types are compatible.)
(2) There are legions of C programmers who apply lint, if at all, far too
    late in the life cycle, after they have already populated their code
    with tons of lint.


>2) Bitwise logical functions - can be used on one dimensional packed
>arrays of booleans.  

But you didn't need the net for this.  It's in the manual!
Think "logical", find "logical operators" in the Ada83 LRM, go to
section 4.5.1 "Logical Operators and Short-Circuit Control Forms",,
and there staring you in the fact is a table that says 'and', 'or',
'xor' apply to "array of boolean components".

>3) Enumeration representation clauses - I knew that I could get round
>the problem I described and I now also know the reasons why the
>restrictions exist although I have not really changed my opinion on
>that point. Richard O'Keefe pointed out the Ada 95 definition of these
>clause, but I have not managed to obtain the Ada 95 LRM yet to get the
>exact context so I cannot really comment for the moment.

For the sake of completeness, I should point out the possibility of generating
the Ada source text.  I can well imagine that if your primary source for the
names and values of the enumeration literals puts them in some funny order,
then you might want the manually edited document to have them in the same
order so that they can be the more easily checked.

Let your codes document have the form

	<number in decimal>	<identifier>	<optional comment>
	...
	<number in decimal>	<identifier>	<optional comment>

with the entries in the order of your primary source.  Call this file
	typename.org

You want to generate
	type <type name> is (
	 <identifier>	-- <optional comment>
	...
	,<identifier>	-- <optional comment>
	);
	for <type name> use (
	 <identifier> => <number>
	...
	,<identifier> => <number>
	);
in a file called
	typename.ada

Put the following shell script in a file called mk-ada-enum:
#!/bin/sh
typename=$1
echo "type $typename is ("
echo "for $typename use (" >$$.use
separator=" "
sort -n | while read number identifier comment ; do
    echo "$separator$identifier	-- $comment"
    echo "$separator$identifier => $number" >>$$.use
    separator=","
done
echo ");"
echo ");" >>$$.use
cat $$.use
rm $$.use

Use it like this:
	mk-ada-enum "Ada_Type_Name" <typename.org >typename.ada

For example, I put these lines in "funny.org":
	4	foo	"d" is not supported
	1	bar	not a wet one
	3	ick	the shut down signal
	2	ugh	response to the shut down signal
Running "mk-ada-enum Funny <funny.org >funny.ada" produced this output:
type Funny is (
 bar	-- not a wet one
,ugh	-- response to the shut down signal
,ick	-- the shut down signal
,foo	-- "d" is not supported
);
for Funny use (
 bar => 1
,ugh => 2
,ick => 3
,foo => 4
);

It isn't pretty, but that doesn't matter, because you maintain the table,
not the generated Ada code.  (The scripting language isn't important; if
it were in TCL I could run it on a Macintosh.)

-- 
Election time; but how to get Labour _out_ without letting Liberal _in_?
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.




  reply	other threads:[~1996-02-21  0:00 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <823906039.22113@assen.demon.co.uk>
     [not found] ` <4fgrq3$mc4@qualcomm.com>
     [not found]   ` <dewar.823962356@schonberg>
1996-02-17  0:00     ` Ada is almost useless in embedded systems Tore Joergensen
1996-02-17  0:00       ` Robert Dewar
1996-02-19  0:00       ` Keith Thompson
1996-02-19  0:00         ` John McCabe
1996-02-21  0:00           ` Richard A. O'Keefe [this message]
1996-02-21  0:00             ` Norman H. Cohen
1996-02-19  0:00 ` AdaWorks
1996-02-21  0:00   ` Ken Garlington
1996-02-23  0:00     ` AdaWorks
1996-02-19  0:00 ` R.A.L Williams
1996-02-21  0:00   ` Richard A. O'Keefe
1996-02-19  0:00 ` Jon S Anthony
     [not found] ` <824056183.18993@assen.demon.co.uk>
     [not found]   ` <311E924E.74CE@escmail.orl.mmc.com>
1996-02-17  0:00     ` Ada is great for embedded systems (was Ada is almost useless in embedded systems) Ken & Virginia Garlington
     [not found]   ` <4fnqpm$3nh@news.sanders.lockheed.com>
1996-02-19  0:00     ` Ada is almost useless in embedded systems AdaWorks
1996-02-21  0:00       ` Ken Garlington
1996-02-21  0:00       ` Hugh Dunne
     [not found]   ` <4fnp37$nj1@theopolis.orl.mmc.com>
1996-02-22  0:00     ` Alan Brain
1996-02-26  0:00 ` R.A.L Williams
     [not found]   ` <4h3q56$1vk@goanna.cs.rmit.EDU.AU>
     [not found]     ` <dewar.825635955@schonberg>
     [not found]       ` <826571250.140@assen.demon.co.uk>
     [not found]         ` <dewar.826634800@schonberg>
1996-03-21  0:00           ` John McCabe
1996-03-23  0:00             ` Side-effect arithmetic again [was: Ada ... in embedded systems] John G. Volan
1996-03-23  0:00               ` Robert Dewar
1996-03-25  0:00                 ` Tucker Taft
1996-03-25  0:00                   ` Robert A Duff
1996-03-25  0:00                   ` Norman H. Cohen
1996-03-26  0:00               ` John G. Volan
1996-03-26  0:00                 ` Robert Dewar
1996-03-29  0:00                   ` Robert I. Eachus
1996-03-26  0:00                 ` Robert A Duff
1996-03-26  0:00                   ` Tore Joergensen
1996-03-27  0:00                     ` John G. Volan
1996-03-29  0:00                       ` Robert A Duff
1996-03-30  0:00                         ` John G. Volan
1996-03-30  0:00                         ` John G. Volan
1996-03-31  0:00                           ` AdaWorks
1996-04-01  0:00                           ` Robert A Duff
1996-03-27  0:00                     ` John G. Volan
1996-03-28  0:00                       ` Tucker Taft
1996-03-28  0:00                         ` Robert Dewar
1996-03-29  0:00                           ` Tucker Taft
1996-03-29  0:00                             ` Tucker Taft
1996-03-27  0:00                     ` John G. Volan
     [not found] ` <emery-0902962215150001@line316.nwm.mindlink.net>
     [not found]   ` <DMoA85.52I@eskimo.com>
     [not found]   ` <823965654.4500@assen.demon.co.uk>
     [not found]     ` <824165619.14894@assen.demon.co.uk>
     [not found]       ` <JSA.96Feb13133713@organon.com>
     [not found]         ` <824259217.26321@assen.demon.co.uk>
1996-02-17  0:00           ` Ada is almost useless in embedded systems Robert Dewar
1996-02-18  0:00             ` John McCabe
1996-02-18  0:00               ` Robert Dewar
1996-02-19  0:00                 ` John McCabe
1996-02-20  0:00                   ` Robert Dewar
1996-02-21  0:00                   ` Fergus Henderson
     [not found]         ` <824332550.2485@assen.demon.co.uk>
1996-02-17  0:00           ` Ken & Virginia Garlington
1996-02-17  0:00             ` Robert Dewar
1996-02-18  0:00               ` John McCabe
1996-02-18  0:00                 ` Robert Dewar
1996-02-19  0:00                   ` John McCabe
     [not found]       ` <4fs7ml$cf1@rational.rational.com>
1996-02-26  0:00         ` Ada 83 " Alan Brain
     [not found] ` <RALW.96Feb28100925@vulcan.gmrc.gecm.com>
1996-03-15  0:00   ` Ada is almost useless " Robert I. Eachus
1996-03-18  0:00     ` Alan Brain
     [not found]       ` <4ik5bm$ogg@dayuc.dayton.saic.com>
1996-03-18  0:00         ` Side-effect arithmetic again [was: Ada ... in embedded systems] Robert Dewar
1996-03-19  0:00           ` Norman H. Cohen
1996-03-19  0:00           ` Jay Martin
1996-03-21  0:00             ` Robert I. Eachus
     [not found]     ` <dirk.827148504@demokrit>
1996-03-18  0:00       ` Ada is almost useless in embedded systems David Weller
     [not found]   ` <dewar.825775334@schonberg>
     [not found]     ` <RALW.96Mar8113005@vulcan.gecm.com>
     [not found]       ` <4hv2fb$6ra@cville-srv.wam.umd.edu>
     [not found]         ` <4xybp895y6.fsf@leibniz.enst-bretagne.fr>
     [not found]           ` <3144CC40.33A0@escmail.orl.mmc.com>
     [not found]             ` <dewar.826604375@schonberg>
     [not found]               ` <3145FF2C.6139@escmail.orl.mmc.com>
     [not found]                 ` <dewar.826829407@schonberg>
     [not found]                   ` <31499D21.1DA6@escmail.orl.mmc.com>
1996-03-15  0:00                     ` Bug or Limitation? (was: Ada is almost useless in embedded systems) Robert Dewar
1996-03-16  0:00                       ` Ted Dennison
1996-03-20  0:00                         ` Side-effect arithmetic again [was: Ada ... in embedded systems] Robert I. Eachus
1996-03-20  0:00                           ` Robert A Duff
1996-03-21  0:00                             ` Peter Hermann
1996-03-21  0:00                               ` Robert Dewar
1996-03-25  0:00                                 ` Robert I. Eachus
1996-03-28  0:00                               ` Mats Weber
1996-03-29  0:00                                 ` John G. Volan
1996-03-20  0:00                           ` John G. Volan
1996-03-22  0:00                             ` Alan Brain
1996-03-21  0:00                           ` Geert Bosch
1996-03-26  0:00                           ` Mats Weber
1996-03-16  0:00 ` Ada is almost useless in embedded systems Kevin Dalley
     [not found] <9603131418.AA01642@eight-ball>
1996-03-15  0:00 ` Norman H. Cohen
1996-03-15  0:00   ` Robert Dewar
1996-03-18  0:00   ` Stephen Crawley
1996-03-18  0:00   ` Peter Hermann
1996-03-18  0:00     ` Robert Dewar
1996-03-19  0:00 ` Laurent Guerby
replies disabled

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