|For novel ideas about building embedded systems (both hardware and firmware), join the 39,000+ engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
By Jack Ganssle
Ada's Lack of Adoption
Poll after poll shows that even after a quarter-century Ada has failed to garner a significant market share in the embedded space. Yet the data is stark: programs written in Ada have fewer bugs and are delivered faster than those written in C.
But wait, there's more!
Ada compilers work (see my soon to be published article on this site which reports that many C tools miscompile code that uses the "volatile" keyword). Ada compilers are checked against the exhaustive Ada Conformity Assessment Test Suite (ACATS).
But wait, there's more!
The most popular Ada compiler, GNAT, is free and is available under the GPL.
Ada was designed from the ground up for high reliability embedded applications. Neither C nor C++ can claim that distinction. The Ravenscar Profile even more finely targets real time embedded systems. Tasking is a built-in feature, not a bolt-on requiring expensive dalliances with RTOS vendors.
You'd think "faster, better and free tools" would be a pretty compelling argument, but it has failed to persuade most of us. Why?
It's probably not due to any inefficiencies. Robert Dewar, president of AdaCore (http://www.adacore.com), tells me that even with all of the runtime checks enabled expect no more than a 20% performance hit compared to C, though he said 10% is more likely.
Maybe I should define "runtime checks," as that concept is alien to the C community. Ada looks for error conditions like divide by zero. You can even define legal ranges for integers. But in C we can write:
num_doses=0; morphine=patient_pain/num_doses; dispense_morphine(morphine);
We can't blame a lack of compilers. AdaCore has ported GNAT to most mainstream 16 and 32 bit CPUs.
In my experience new Ada developers typically hate the language. It makes one work very hard to get a compileable source file. The old saying is "if you can make the damn thing compile at all, it will work." But after about three Ada projects most programmers learn to love the language. Sure, they put more effort into getting the code right (which is surely a Good Thing), but they save mounds of time in debug.
What's your take on Ada? As correspondent Rich Ries wrote to me: "Maybe Ada's lack of success is like a healthy life-style -- something we all know we <i>should</i> have, but few actually employ it!!