Bye, Chris.
PS: flame accepted ![:wink: :wink:](/images/emoji/twitter/wink.png?v=12)
Um den flame abzuschliessen: :=)
Newsgroups: comp.lang.ada
Message-ID: <9510142005.AA18714(a)source.asset.com>
Sender: Ada programming language <INFO-ADA(a)VM1.NODAK.EDU>
Lines: 164
Greetings:
I'm sitting here waxing melancholy about the C vs Ada religious wars!
As a person who has used both languages to develop a number
of real applications, I'd like to make several observations.
If I'm writing some quick and dirty little hack, C is my
language of choice. If I'm writing a system that needs to
be designed and must be maintained, Ada is my language of
choice. An analogy will clarify things; if you want to
build a doghouse, the tools in your garage are probably ok.
If you want to build a skyscraper, they are probably not ok.
Hopefully you can convince your boss to select the right set
of tools (naturally, if the boss says "use C", I gotta eat, so
I use C). IBM's OS/2 proves that you can produce a large
system even with assembly language. The question is, why go
through all the pain of using a low level language like
assembler or C when you can use a high level language like
Ada?
Based solely on my own experiences with Ada and C, I submit
the following food for thought. I'll ask the Rt Rev'd, Comrad
Trung, and the other pontificators to not pick on my syntax
errors. This is only flame-bait, so I did not bother to
verify the code snippets. [flame on]
1. if "xyzzy" has no meaning to you, you are not old enough
to participate in this thread
2. old age and treachery will always overcome youth and
strength
3. if 10_000 lines of codes seems big to you, you don't
have the experience to participate in this thread
4. if you have the intellectual and physical capacity to
single-handedly deal with your program, it's a toy
5. you learn how to swim well by swimming, not by just
reading or preaching about swimming
6. which C are you talking about, K&R C, the veneer of C++, ANSI C,
Borland C, vanilla C... ???
7. the C religion encourages obfuscation, the Ada religion
does not (us C hackers *KNOW* this is true)
8. Ada was engineered to support software engineering, C
was hacked
9. why would anyone take the square root of the letter,
'a', and why would any compiler accept it? (Oh, but my
brand X compiler warns me, oh, I can run lint, oh, oh, oh!)
The question is why does C allow such nonsense?
10. if EOF really is a char, why should we use an int, as in
int c; while ((c=getchar())!=EOF)?
11. Ada's compile-time enforcement of the transitive closure
requires architectural design, not guesswork
12. if rush.is_wrong(frequency=>always); is broken you know where
to look in the Ada code, if is_wrong(always); is broken,
good luck finding it in the C code!
13. Ada's compile-time requirement that an object value
belong to a specified domain reduces errors
14. Ada's compile-time enforcement of matching formal to
actual parameter domains reduces errors
15. Ada's parameter modes allow pass by value *or* pass by
reference, in C you gotta play games with pointers, which will
generally result in that most famous of run-time outputs,
segmentation violation, core dumped
16. Ada allows aggregate array assignment and slices and
concatenation and comparison without loops or libraries
17. Ada blocks facilitate dynamic data types and variable
declarations, et al
18. Ada's package mechanism directly supports information
hiding, modularity, abstraction, etc. (the software engineering
hooey that prevents us hackers from playing or "being
clever", or adhering to a design, etc.)
19. Ada tasks significantly simplify real-time programming,
ask the folks at Silicon Graphics about Paintball if you
don't believe me
20. perhaps the most understated advantage of Ada are her
attributes: 'range easier than passing and maintaining size:
'first and 'last easier passing than passing and maintaining
last: 'pos 'val 'value 'image 'pred 'succ, 'size 'address,
ad nauseaum, all make programming in Ada a whole lot easier:
about the only thing C offers is sizeof, and real men don't
use it!
21. /= easier than != on most keyboards, e.g., ! == Shift+1
22. = easier than ==
23. := harder than = to ensure change of state is a
conscious decision, not a screwup
24. yo:while anything loop foo; bar; end loop yo; is
correct, while (anything) foo();bar(); is not: eventually,
us C hackers learn to *always* use {} to avoid this kind of
hard to detect bug, and to put comments at the loop's end to
figure out where it started
25. x := x + n; is intuitive to even a child, x += n; must
be memorized, add this to all the other "nifty shortcuts" in
C, and it is a real PITA to learn and to teach
26. macros are deceptive, e.g., x++ as a macro argument can
produce interesting results
27. if x > 3 then y:= 3; elsif y<1 then y:= 1;else y:= 2;
end if; is intuitive, y=(x>3)?3:((y<1)?1:2); is absurd (yeah, I
know, *you* would never use this in a C program. Reality check
boys, I see this kind of crap all the time)
28. c:=foo;yo:while c/=done loop bar;c:=foo;end loop yo;
works, while(c=foo()!=done)bar(); does not: eventually us C
hackers learn to use parenthesis in an almost defensive mode
to avoid such hard to detect bugs
29. ho:for i in ray'range loop foo(i);bar(ray(i));end loop
ho; is easier than int i; for (i=0;
i<sizeof(ray)/sizeof(ray[0]); i++){foo(i);bar(ray([i]);}
30. case x is when a => xyzzy; when others=>fubar;end case;
easier than switch(x){a:xyzzy();break;default:fubar();}, us
C hackers eventually remember to put that break in there (if
we really intend to use a case as a case)
31. if (x=0) {blew();it();} will always be dead code, if x=0
then blew; it; end if; will not, eventually we C hackers
learn how to detect this nasty little "if false" bug
32. if x/=0 and then 1/x>3 then ba;boom;end if; is safer and
easier than if ((x!=0)&&(1/x>3)){ba();boom();}
33. -- easier than /* ... */, and you won't accidently lose
code by failing to close a comment (I'd never do that)
34. author.qualities(age=>43,eyes=>blue,attitude=>bad); more
intuitive than qualities(43,BLUE,BAD);
35. Ada will not allow you to walk off the end of an array
and silently nuke other data
36. Have you ever tried explaining to a novice why if (!strcmp(a,b))
actually means the strings are equal even though it seems to
suggest the opposite?
37. Ada is a classy lady; to associate with her, you must
follow certain rules and behave like a gentleman.
C is a tramp who will let you do anything. If all I want is a quickie
I'll use C. If I expect a long-term relationship with the code,
or want to take the code out in public, I'll usa Ada.
Jerry [flame off] Morris