[NTLUG:Discuss] Linux Programming Classes??

Darin W. Smith darin_ext at darinsmith.net
Tue Jul 1 16:54:51 CDT 2003


On Tue, 01 Jul 2003 15:22:04 -0500, Greg Edwards <greg at nas-inet.com> wrote:
> I have not had the pleasure of doing Ada.  I never could afford the 
> compiler or the out of pocket for a security clearance to get into 
> defence contracts.  I have looked at Ada and I know several people that 
> think it's really great to work with.  Kind of a PL/I done right.  Do Ada 
> compilers still require DoD cert?
>

If they are to be used on a defense project, then the DoD does have to have 
it on its list of approved compilers.  However, that is not as strict as it 
used to be.

There used to be a free GCC-based Ada compiler named GNAT at 
http://www.cs.nyu.edu/cs/projects/gnat/

It has gone commercial at www.gnat.com.  You may still be able to get some 
free tools.  In fact, this open-source compiler is the leading Ada95 
compiler, and is almost certainly DoD approved, as it is being used by 
Rockwell for avionics and is being redistributed by WindRiver.  I know back 
in '97 I was involved in an effort to port code from a compiler that ran 
specifically on SGIs to GNAT as some of us had the idea that for 
feasibility work at least we could potentially use a farm of Linux boxes to 
build and run simulations and therefore save some major cash over all the 
SGI boxes we were chewing up.

Ada is no longer strictly required by the DoD, either.  I was kind of 
disappointed by that, as I've seen lots of really sloppy C/C++ code that 
were it implemented in Ada, no Ada compiler would ever let through.  When 
you first start programming in Ada, it is quite frustrating.  I hear C++ 
called a "strongly typed" language.  Hah!  Ada is draconian about types, 
pure and simple.  But the time it costs you in getting code the compiler 
will grok saves you 10x that amount of time as you can be assured that run- 
time errors are almost nil.  Errors in your logic, yes...no language makes 
you smarter.  Bus errors or seg-faults?  Not at all likely.  Once you leave 
the "novice" stage and enter the "journeyman" stage, the Ada compiler has 
made you a much more careful programmer.

Think of it as a C compiler being set to interpret all warnings as errors, 
and just for good measure throws in lint in its entirety.  Only once you've 
gotten the code clean enough to pass all that does it give you a successful 
object module.  Very fussy, but by being careful, you can learn to write 
code that will compile and run the first time.  You then just have to 
verify that you told it to compute the right numbers--much easier than 
figuring out where you forgot to dereference a pointer or stepped beyond an 
array or the like.

Best Ada story I have?  Years after leaving the defense industry, I was 
working at a telecom startup with more than a few former defense workers.  
In a code-review of some of my code, I'd made a subtle C++ error (I can't 
remember what--probably a strange cast that the compiler allowed but would 
give an undesired result).  I commented that C++ was a hideous language for 
allowing me to even do that.  A friend of mine (realizing my thought 
pattern) then polled the reviewers:  "Who here wishes this project was 
written using Ada?"  The vote was unanimous in favor of Ada amongst all 
those who had been exposed to both languages.  How did my friend know what 
I was thinking? We had worked on the same project using Ada.  She had 
commented on many occasions how she likes to read my code, and can spot it 
from a mile away, because it looks so much like her own.  No coincidence.  
We probably both write that way because of habits we picked up with Ada and 
with the coding standard on that other project.

Not that I think C++ is a bad language.  It's not, and unfortunately C++ 
compilers are often used simply as fancy C compilers where you can use the 
// single-line comment (borrowed from the -- in Ada) and where a "class" 
can be used as a fancy "struct."  Very unfortunate indeed.  It is quite 
rare for me to see its exception handling used (try and catch, also loosely 
inspired by Ada).  Plus, hey, the father of C++ (Bjarne Stroustrup) is at 
my Alma Mater now, so I have to like him!

-- 
D!
Darin W. Smith
AIM: JediGrover
"If you pick up a starving dog and make him prosperous, he will not bite 
you. This is the principal difference between a dog and a man." --Mark 
Twain "Pudd'nhead Wilson's Calendar"



More information about the Discuss mailing list