comp.lang.ada
 help / color / mirror / Atom feed
From: mking@fsd.com (Mike King)
Subject: Re:  Software vendors not using Ada but C
Date: Tue, 22 Jun 93 08:30:30 EDT	[thread overview]
Message-ID: <9306221230.AA05804@sed00.sed> (raw)

In INFO-ADA Digest, V93, #387,  Colin James 0621 <cjames@dsc.blm.gov> writes:
 
> Ted Holden writes that "Programs written in geneic C port, from just about
> anything to just about anything else".
>   
> This argument is mistaken as anyone knows who has worked on a larger C
> project of greater than 10,000 lines of code.
> 
> Consider the generic C statement:  c=a+++b;  .
> 
> This ambiguous statement can mean four things which are all equally 
> admissible as ANSI C:
>   
> 1.  a = a + 1 ;  c = a + b ;
> 2.  b = b + 1 ;  c = a + b ;
> 3.  c = a + b ;  a = a + 1 ;
> 4.  c = a + b ;  b = b + 1 ;
>   
> Note that Appendix F of the the ANSI C standard suggests that in cases 
> where language syntax is ambiguous, the use of spaces can alleviate
> confusion.  But who ever heard of an ANSI language which relies on 
> spaces to que the compiler.  

Have the postfix and prefix operators changed meaning?  I learned "x++" means
"reference x, then increment it," while "++x" means "increment x, then 
reference it."  Therefore, ambiguity in the generic C statement ` c=a+++b; '
should either be:

1.  c = a + b; a = a + 1;     [c = (a++) + b]   or
2.  b = b + 1; c = a + b;     [c = a + (++b)]

However, the real problem is the fact the statement doesn't convey the
intention to the reader/future code maintainer.  Only a poor software
engineer would write a statement like `c=a+++b;' in his/her code; the
rest of us would write `c=(a++)+b;' or `c=a+(++b);' so as not to depend
on the order of evaluation, and more importantly, to inform future
generations what was intended by the statement.

OTOH, I've maintained and ported Ada code that is just as
uncommunicative.  The only difference is the Ada code made a subroutine
call instead of using a built-in operator.  The code in question did
not have any commentary to tell the reader what was being done (why the
subroutine was called, what it did to the parameters, what it returned,
etc.).

I've also heard too many people say that "Ada is self documenting."  Bull snot.
Written by a poor software engineer, Ada can be as convoluted, twisted, and
confusing as Latin, and in the hands of a good software engineer, C can be
a work of art.


> Mike <

-------------------------------------------------------------------------------
Mike King           |  +1 301-428-5384            |  I don't speak for my
Software Sourcerer  |  mking@fsd.com or           |  employer.  My employer
Fairchild Space     |  73710.1430@compuserve.com  |  doesn't speak for me.
-------------------------------------------------------------------------------

A gleekzorp without a tornpee is like a quop without a fertsneet (sort
of).

             reply	other threads:[~1993-06-22 12:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-06-22 12:30 Mike King [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-06-27 12:38 Software vendors not using Ada but C David Weller
1993-06-25 23:39 Mark Bayern
1993-06-24  6:05 ghost.dsi.unimi.it!univ-lyon1.fr!scsing.switch.ch!epflnews!disuns2.epfl.c
1993-06-23 22:10 Michael Feldman
1993-06-23 20:44 cis.ohio-state.edu!math.ohio-state.edu!uwm.edu!ogicse!netnews.nwnet.net!n
1993-06-23 20:33 Robert Firth
1993-06-23 19:07 Bill Yow
1993-06-22 15:33 agate!howland.reston.ans.net!math.ohio-state.edu!sdd.hp.com!col.hp.com!cs
1993-06-22  6:50 cis.ohio-state.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!cs.utexa
1993-06-18 14:19 Colin James 0621
replies disabled

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