comp.lang.ada
 help / color / mirror / Atom feed
* Ada is 'better' than C because...
  1996-07-27  0:00 C is 'better' than Ada because Tim Behrendsen
@ 1996-07-29  0:00 ` John Herro
  1996-07-30  0:00   ` Brian Rogoff
  1996-08-04  0:00   ` Richard Riehle
  1996-08-08  0:00 ` William Clodius
  1 sibling, 2 replies; 25+ messages in thread
From: John Herro @ 1996-07-29  0:00 UTC (permalink / raw)



"Tim Behrendsen" <tim@airshields.com> writes:
> If C is so bad (in many people's opinion,
> not mine), why is it used almost universally?
     Inertia!  Because it's effort to change!
     Why are we all using qwerty keyboards when we know that Dvorak is
better?  Inertia!  It would be a lot of effort to unlearn qwerty and learn
Dvorak!
     Why hasn't the U.S. switched to the metric system, which is obviously
much easier to work with?  Inertia!  The cost of changing!
     Why don't all the schools teach Esperanto as a second language, so
that anyone in the world could communicate with anyone?  Inertia!  The
difficulty of finding teachers for a relatively little-known language!
     Ada really *IS* an improvement over C.  C's biggest fault is that is
doesn't have procedures, only functions.  To modify calling parameters, C
has to use difficult-to-read and error-prone pointers, in a situation
where pointers shouldn't be necessary at all.
     C and qwerty are "used almost universally" because they're older and
are firmly established, even though both have been improved upon.
- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor
----------
MUSIC is easier to read when written in C.
SOFTWARE is easier to read when written in Ada.
----------




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-07-30  0:00   ` Brian Rogoff
@ 1996-07-30  0:00     ` Adam Beneschan
  1996-07-31  0:00     ` Franz Kruse
  1 sibling, 0 replies; 25+ messages in thread
From: Adam Beneschan @ 1996-07-30  0:00 UTC (permalink / raw)



rogoff@sccm.stanford.edu writes:

 >I agree that Ada is better than C, however, I have always been puzzled by the
 >distinction in Ada between functions and procedures, which I view as an
 >unnecessary relic of Pascal. Why not just allow procedures which return 
 >things? 

This question has, in the past, led to a religious war on
comp.lang.ada almost as great as "Which is the one true language?"  I
don't remember all the arguments on both sides.  However, I'd
recommend reading Bertrand Meyer's _Object-Oriented Software
Construction_, which makes a case for keeping the two concepts
separate.  Put simply, in Meyer's view, procedures tell an object to
DO SOMETHING, while functions ASK SOMETHING of an object.  Functions,
therefore, should be pure query operations that don't change anything
and will therefore return the same result if you call the function
several times in succession.  In Eiffel, Meyer's language, there is no
such thing as an IN or IN OUT parameter; procedures are not allowed to
return any values (but they may change the state of the object).

Even with this conceptual distinction, I suppose you could define both
"functions" and "value-returning procedures" in the language (as an
early Ada draft did).  However, they would appear syntactically
identical when you called the function or procedure, making it
non-obvious whether you're calling a function that does something
interesting on the side or not.

One last comment: one could also consider value-returning procedures
to be a "relic" of assembly language, in which you write a subroutine
that performs some action and returns a status value in the
accumulator register.  This is sort of how UNIX system calls strike me.

                                -- Adam


---
DWARF STABS ELF
Film at 11







^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-07-29  0:00 ` Ada is 'better' than C because John Herro
@ 1996-07-30  0:00   ` Brian Rogoff
  1996-07-30  0:00     ` Adam Beneschan
  1996-07-31  0:00     ` Franz Kruse
  1996-08-04  0:00   ` Richard Riehle
  1 sibling, 2 replies; 25+ messages in thread
From: Brian Rogoff @ 1996-07-30  0:00 UTC (permalink / raw)



johnherro@aol.com (John Herro) writes:
   "Tim Behrendsen" <tim@airshields.com> writes:
   > If C is so bad (in many people's opinion,
   > not mine), why is it used almost universally?
	Inertia!  Because it's effort to change!

But how did it become so popular that it could have inertia working on its 
side? Pascal appeared at roughly the same time, FORTH and PL/1 precede
it. 

	Why don't all the schools teach Esperanto as a second language, so
   that anyone in the world could communicate with anyone?  Inertia!  The
   difficulty of finding teachers for a relatively little-known language!

Besides, broken English is the de-facto Esperanto ;-).

	Ada really *IS* an improvement over C.  C's biggest fault is that is
   doesn't have procedures, only functions.  To modify calling parameters, C
   has to use difficult-to-read and error-prone pointers, in a situation
   where pointers shouldn't be necessary at all.

I agree that Ada is better than C, however, I have always been puzzled by the 
distinction in Ada between functions and procedures, which I view as an
unnecessary relic of Pascal. Why not just allow procedures which return 
things? Your complaint about C is more about its lack of parameter modes.

-- Brian




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-07-30  0:00   ` Brian Rogoff
  1996-07-30  0:00     ` Adam Beneschan
@ 1996-07-31  0:00     ` Franz Kruse
  1 sibling, 0 replies; 25+ messages in thread
From: Franz Kruse @ 1996-07-31  0:00 UTC (permalink / raw)



rogoff@sccm.Stanford.EDU (Brian Rogoff) writes:

> 	Why don't all the schools teach Esperanto as a second language, so
>    that anyone in the world could communicate with anyone?  Inertia!  The
>    difficulty of finding teachers for a relatively little-known language!
>
> Besides, broken English is the de-facto Esperanto ;-).

Well, yes - to a fairly limited extent and the accent clearly being on BROKEN.
Don't let esperantists (I am one) hear that, they will feel sorry for you with
how little you are satisfied, compared to what you could have with ("unbroken")
Esperanto - not counting the enormous effort necessary to keep (and constantly
reproduce) this modest status quo (not for YOU, for us non-English speaking
countries only, of course).

Franz Kruse







^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-07-29  0:00 ` Ada is 'better' than C because John Herro
  1996-07-30  0:00   ` Brian Rogoff
@ 1996-08-04  0:00   ` Richard Riehle
  1996-08-05  0:00     ` Sandy McPherson
  1 sibling, 1 reply; 25+ messages in thread
From: Richard Riehle @ 1996-08-04  0:00 UTC (permalink / raw)





The C family of languages is inherently dangerous.

A programming language for which pointer arithmetic is an essential
feature of non-trivial programs is not a language I want controlling
the systems where my life is on the line.   And, frankly, I don't care
how skilled the programmer is.  This is still an area where mistakes
occur all too frequently.

Richard Riehle






^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-04  0:00   ` Richard Riehle
@ 1996-08-05  0:00     ` Sandy McPherson
  1996-08-06  0:00       ` Ken Garlington
                         ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Sandy McPherson @ 1996-08-05  0:00 UTC (permalink / raw)



Richard Riehle wrote:
> 
> The C family of languages is inherently dangerous.
> 
> A programming language for which pointer arithmetic is an essential
> feature of non-trivial programs is not a language I want controlling
> the systems where my life is on the line.   And, frankly, I don't care
> how skilled the programmer is.  This is still an area where mistakes
> occur all too frequently.
> 
> Richard Riehle

I have a view comments to make to your objective and considered
statements:

All programming languages are inherently dangerous, because they are
used by humans to write faulty software (see The Ariane debacle).

Since when was pointer arithmetic "essential"? It is simply convenient. 

I agree all programmers make mistakes, and too many of them. Intelligent
and workable coding standards need to be strictly applied in all
languages and tools must exist which can measure and report on
adherence/breach of the rules. The fact is that the primary tools (those
which you must use to get your program to run) for Ada are better than
those for C (e.g. the compiler, the APSE and the run-time system), but
some of the secondary tools for C can be better (e.g. QAC, Purify), the
problem being simply "you don't HAVE to use them", and you have to pay
extra for them (the (f)law of false economies). 

To get an objective view of whether one language is better than the
other, one has to evaluate statistics on error densities in comparable
systems written in the protagonist languages. Most people who have done
this come to this conclusion: the choice of programming language only
counts if the choice is between assembler and something else; and for
most mainstream higher languages the process of software development is
the determining factor. Try starting with a paper by Les Hutton, "Static
inspection - must have or might have?", published in IEEE software 1995,
which gives references to other interesting reading.

Sandy McPherson




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-05  0:00     ` Sandy McPherson
@ 1996-08-06  0:00       ` Ken Garlington
  1996-08-06  0:00         ` GAFFNEY.BRIAN
                           ` (3 more replies)
  1996-08-07  0:00       ` Bob Kitzberger
  1996-08-08  0:00       ` Robert Dewar
  2 siblings, 4 replies; 25+ messages in thread
From: Ken Garlington @ 1996-08-06  0:00 UTC (permalink / raw)



Sandy McPherson wrote:
> 
> To get an objective view of whether one language is better than the
> other, one has to evaluate statistics on error densities in comparable
> systems written in the protagonist languages. Most people who have done
> this come to this conclusion: the choice of programming language only
> counts if the choice is between assembler and something else; and for
> most mainstream higher languages the process of software development is
> the determining factor. Try starting with a paper by Les Hutton, "Static
> inspection - must have or might have?", published in IEEE software 1995,
> which gives references to other interesting reading.

For a counter-example, see this study (which did evaluate error densities):

  http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html

From the summary:

"The choice of programming language is only one of many factors in project successes 
and failures. In our opinion, it is NOT the most important.... The language choice may 
only change expenses by a factor of two. Of course, a million dollars here and a 
million dollars there and pretty soon you're talking about real money."

So, although other factors such as software process may have a greater impact, at
least this study indicates that choice of programming language is a significant
issue. In this study, the same project done in C and Ada had significantly lower
error densities in the C version.

> 
> Sandy McPherson

-- 
LMTAS - "Our Brand Means Quality"




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-06  0:00       ` Ken Garlington
@ 1996-08-06  0:00         ` GAFFNEY.BRIAN
  1996-08-07  0:00           ` Ken Garlington
  1996-08-08  0:00         ` Theodore E. Dennison
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 25+ messages in thread
From: GAFFNEY.BRIAN @ 1996-08-06  0:00 UTC (permalink / raw)



In article <320729F1.1ADC@lmtas.lmco.com>, Ken Garlington <garlingtonke@lmtas.lmco.com> writes...
>  http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html
..
>       In this study, the same project done in C and Ada had significantly 
>lower error densities in the C version.
 ^^^^^                        ^
I must have been reading a different article of the same name at the same site,
because I thought the result was just the opposite - C had _higher_ "error
densities" than Ada. 




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-06  0:00         ` GAFFNEY.BRIAN
@ 1996-08-07  0:00           ` Ken Garlington
  0 siblings, 0 replies; 25+ messages in thread
From: Ken Garlington @ 1996-08-07  0:00 UTC (permalink / raw)



GAFFNEY.BRIAN wrote:
> 
> In article <320729F1.1ADC@lmtas.lmco.com>, Ken Garlington <garlingtonke@lmtas.lmco.com> writes...
> >  http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html
> ..
> >       In this study, the same project done in C and Ada had significantly
> >lower error densities in the C version.
>  ^^^^^                        ^
> I must have been reading a different article of the same name at the same site,
> because I thought the result was just the opposite - C had _higher_ "error
> densities" than Ada.

Well, of course, it depends upon your definition of densities, and...

Oh, never mind. Of course I meant the Ada version had a lower error density than
the C version. People are just so picky...

-- 
LMTAS - "Our Brand Means Quality"




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-05  0:00     ` Sandy McPherson
  1996-08-06  0:00       ` Ken Garlington
@ 1996-08-07  0:00       ` Bob Kitzberger
  1996-08-08  0:00       ` Robert Dewar
  2 siblings, 0 replies; 25+ messages in thread
From: Bob Kitzberger @ 1996-08-07  0:00 UTC (permalink / raw)



Sandy McPherson (sandy@wgs.estec.esa.nl) wrote:

: To get an objective view of whether one language is better than the
: other, one has to evaluate statistics on error densities in comparable
: systems written in the protagonist languages. Most people who have done
: this come to this conclusion: the choice of programming language only
: counts if the choice is between assembler and something else; and for
: most mainstream higher languages the process of software development is
: the determining factor.

We develop systems in Ada, C, and C++.  For years, defect rates were
measured for these (comparable) systems, and C did not fare well at
all compared to Ada.  We sell development environments for these three
languages, so we have no particular axe to grind.  Check our WWW page
for the article.

--
Bob Kitzberger	      Rational Software Corporation       rlk@rational.com
http://www.rational.com http://www.rational.com/pst/products/testmate.html




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-08  0:00         ` Theodore E. Dennison
@ 1996-08-08  0:00           ` Frank Lipski
  0 siblings, 0 replies; 25+ messages in thread
From: Frank Lipski @ 1996-08-08  0:00 UTC (permalink / raw)



Theodore E. Dennison wrote:
> 
> Ken Garlington wrote:
> >
> > For a counter-example, see this study (which did evaluate error densities):
> >   http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html
> ...
> > issue. In this study, the same project done in C and Ada had significantly lower
> > error densities in the C version
> 
> Hmmm. I read the same study, but I thought the conclusion was the other way around;
> unless my math is bad again. (Lower "error density" ==> less errors, right?)
> 
> The following was the heading on the conclusion -
>    CONCLUSION: Development Costs of C Exceed Those of Ada
> 
> --
> T.E.D.
>                 |  Work - mailto:dennison@escmail.orl.mmc.com  |
>                 |  Home - mailto:dennison@iag.net              |
>                 |  URL  - http://www.iag.net/~dennison         |

   My reading of the report would agree with Ted's.  To summarize
  
defects/KSLOC  = 0.676 for C files and 0.096 for Ada files
-- 
----------------------------------------------------------------------
Standard Disclaimer applies.
      Frank Lipski   lipski@cs.lmco.com          770-494-8322
"The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" ("I found it!") but rather "hmm....that's
funny..."  --   Isaac Asimov
---------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-08  0:00       ` Robert Dewar
@ 1996-08-08  0:00         ` Kevin D. Quitt
  0 siblings, 0 replies; 25+ messages in thread
From: Kevin D. Quitt @ 1996-08-08  0:00 UTC (permalink / raw)



On 8 Aug 1996 00:22:01 -0400, dewar@cs.nyu.edu (Robert Dewar) wrote:

>Sandy said
>
>"Since when was pointer arithmetic "essential"? It is simply convenient."
>
>Avoiding pointer arithmetic in C is pretty restrictive, it means not
>using arrays at all (remember that in C the notation a[b] is simply
>a shorthand for pointer arithmetic).

That's a meaningful argument.  Based on this, all lanaguages have pointer
arithmetic, and it ain't so.

-- 
#include <standard_disclaimer.h>
 _
Kevin D Quitt  USA 91351-4454           96.37% of all statistics are made up
Per the FCA, this email address may not be added to any commercial mail list




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-06  0:00       ` Ken Garlington
  1996-08-06  0:00         ` GAFFNEY.BRIAN
@ 1996-08-08  0:00         ` Theodore E. Dennison
  1996-08-08  0:00           ` Frank Lipski
  1996-08-09  0:00         ` Sandy McPherson
  1996-08-15  0:00         ` Mike Stark
  3 siblings, 1 reply; 25+ messages in thread
From: Theodore E. Dennison @ 1996-08-08  0:00 UTC (permalink / raw)



Ken Garlington wrote:
> 
> For a counter-example, see this study (which did evaluate error densities):
>   http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html
...
> issue. In this study, the same project done in C and Ada had significantly lower
> error densities in the C version

Hmmm. I read the same study, but I thought the conclusion was the other way around;
unless my math is bad again. (Lower "error density" ==> less errors, right?)

The following was the heading on the conclusion -
   CONCLUSION: Development Costs of C Exceed Those of Ada

-- 
T.E.D.          
                |  Work - mailto:dennison@escmail.orl.mmc.com  |
                |  Home - mailto:dennison@iag.net              |
                |  URL  - http://www.iag.net/~dennison         |




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-07-27  0:00 C is 'better' than Ada because Tim Behrendsen
  1996-07-29  0:00 ` Ada is 'better' than C because John Herro
@ 1996-08-08  0:00 ` William Clodius
  1996-08-09  0:00   ` Robert Dewar
                     ` (2 more replies)
  1 sibling, 3 replies; 25+ messages in thread
From: William Clodius @ 1996-08-08  0:00 UTC (permalink / raw)



In article <320a638d.534305610@netline-fddi.jpl.nasa.gov>
kdq@emoryi.jpl.nasa.gov (Kevin D. Quitt) writes: 

   On 8 Aug 1996 00:22:01 -0400, dewar@cs.nyu.edu (Robert Dewar) wrote:

   >Sandy said
   >
   >"Since when was pointer arithmetic "essential"? It is simply convenient."
   >
   >Avoiding pointer arithmetic in C is pretty restrictive, it means not
   >using arrays at all (remember that in C the notation a[b] is simply
   >a shorthand for pointer arithmetic).

   That's a meaningful argument.  Based on this, all lanaguages have pointer
   arithmetic, and it ain't so.

Not quite. First when passed as an argument to a user defined function
a C array looses a lot of its distinction from a pointer, a problem
that many other languages do not have. Second, while (almost?) all
languages that have arrays have indexing, a number of languages, have
additional capabilities that C arrays lack, the ability to specify
array shape in arguments (Fortran I), and various forms of whole array
operations, APL, PL/I, Algol 68, and Fortran 90.
-- 

William B. Clodius		Phone: (505)-665-9370
Los Alamos National Laboratory	Email: wclodius@lanl.gov
Los Alamos, NM 87545




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-05  0:00     ` Sandy McPherson
  1996-08-06  0:00       ` Ken Garlington
  1996-08-07  0:00       ` Bob Kitzberger
@ 1996-08-08  0:00       ` Robert Dewar
  1996-08-08  0:00         ` Kevin D. Quitt
  2 siblings, 1 reply; 25+ messages in thread
From: Robert Dewar @ 1996-08-08  0:00 UTC (permalink / raw)



Sandy said

"Since when was pointer arithmetic "essential"? It is simply convenient."

Avoiding pointer arithmetic in C is pretty restrictive, it means not
using arrays at all (remember that in C the notation a[b] is simply
a shorthand for pointer arithmetic).





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-06  0:00       ` Ken Garlington
  1996-08-06  0:00         ` GAFFNEY.BRIAN
  1996-08-08  0:00         ` Theodore E. Dennison
@ 1996-08-09  0:00         ` Sandy McPherson
  1996-08-15  0:00         ` Mike Stark
  3 siblings, 0 replies; 25+ messages in thread
From: Sandy McPherson @ 1996-08-09  0:00 UTC (permalink / raw)
  To: Ken Garlington


Thanks for the info, it is very interesting. I also have no particular
axe to grind about the languages, as I am a fan of both C and Ada, I
just happen to have to use C a lot more often (and have to apply QAC and
Purify rigourously) and in the sorts of programs I deal with (spacecraft
simulations) I have seen no evidence of wildly differing error densities
(maybe because we're better at C than Ada of course!). The more info I
can get on both languages (and C++) the better.

I do however have an axe to grind with people who make statements like:

"the C family of languages are inherently dangerous, because they have
pointers" 

to paraphrase the post I was replying to, and are not prepared to or
capable of providing evidence to support the statement.

-- 
Sandy McPherson	MBCS CEng.	tel: 	+31 71 565 4288 (w)
ESTEC/WAS
P.O. Box 299
NL-2200AG Noordwijk




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-08  0:00 ` William Clodius
  1996-08-09  0:00   ` Robert Dewar
@ 1996-08-09  0:00   ` Kevin D. Quitt
  1996-08-12  0:00   ` OBryan Anthony H
  2 siblings, 0 replies; 25+ messages in thread
From: Kevin D. Quitt @ 1996-08-09  0:00 UTC (permalink / raw)



On 08 Aug 1996 16:46:39 -0600, clodius@hotspec.lanl.gov (William Clodius)
wrote:
>   >Avoiding pointer arithmetic in C is pretty restrictive, it means not
>   >using arrays at all (remember that in C the notation a[b] is simply
>   >a shorthand for pointer arithmetic).
>
>   That's a meaningful argument.  Based on this, all lanaguages have pointer
>   arithmetic, and it ain't so.
>
>Not quite. First when passed as an argument to a user defined function
>a C array looses a lot of its distinction from a pointer, a problem
>that many other languages do not have. 

Only notationally.  All the languages have to go through similar "pointer
arithmetic" to calculate array offsets.  In fact, with C's array-of-pointers-
as-a-two-dimensional-array, it does *less* pointer arithmetic.


>Second, while (almost?) all
>languages that have arrays have indexing, a number of languages, have
>additional capabilities that C arrays lack,

Without a doubt.  But this has nothing to do with eliminating arrays (only) in
C if pointer arithmetic is not allowed.

-- 
#include <standard_disclaimer.h>
 _
Kevin D Quitt  USA 91351-4454           96.37% of all statistics are made up
Per the FCA, this email address may not be added to any commercial mail list




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-08  0:00 ` William Clodius
@ 1996-08-09  0:00   ` Robert Dewar
  1996-08-09  0:00   ` Kevin D. Quitt
  1996-08-12  0:00   ` OBryan Anthony H
  2 siblings, 0 replies; 25+ messages in thread
From: Robert Dewar @ 1996-08-09  0:00 UTC (permalink / raw)



Kevin said

"   On 8 Aug 1996 00:22:01 -0400, dewar@cs.nyu.edu (Robert Dewar) wrote:

   >Sandy said
   >
   >"Since when was pointer arithmetic "essential"? It is simply convenient."
   >
   >Avoiding pointer arithmetic in C is pretty restrictive, it means not
   >using arrays at all (remember that in C the notation a[b] is simply
   >a shorthand for pointer arithmetic).

   That's a meaningful argument.  Based on this, all lanaguages have pointer
   arithmetic, and it ain't so.

No, that's quite wrong. Semantically in C, a[b] is just syntactic sugar
for *(a+b), and to emphasize this, it is always fine in C to replace
a[b] by b[a] (where a is the "array" and b is the "subscript"). In almost
all other Algol style languages, and in Fortran, array subscripting is a
first class operation in the language. Quite a big difference!

So the claim that all languages have pointer arithmetic semantics and use
them when the index arrays is quite wrong (for example it would be 
perfectly fine in Ada to use hash tables to represent arrays).





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-08  0:00 ` William Clodius
  1996-08-09  0:00   ` Robert Dewar
  1996-08-09  0:00   ` Kevin D. Quitt
@ 1996-08-12  0:00   ` OBryan Anthony H
  1996-08-12  0:00     ` Bob Kurtz
                       ` (3 more replies)
  2 siblings, 4 replies; 25+ messages in thread
From: OBryan Anthony H @ 1996-08-12  0:00 UTC (permalink / raw)



William Clodius (clodius@hotspec.lanl.gov) wrote:

: Not quite. First when passed as an argument to a user defined function
: a C array looses a lot of its distinction from a pointer, a problem
: that many other languages do not have. Second, while (almost?) all

  I have a hard time seeing this as a problem.  It's one of the fantastic 
advantages of the C language.  An array of any given type can be passed 
to a user function and treated as an array of any other integral type, 
converted, processed, etc. in any manner the programmer desires.

: additional capabilities that C arrays lack, the ability to specify
: array shape in arguments (Fortran I), and various forms of whole array
: operations, APL, PL/I, Algol 68, and Fortran 90.

What do you mean by array shape?  C is fully capable of performing whole 
array operations.  The capability is not embedded in the language, as C 
is designed to provide only the bare necessicities for program 
development with all else being provided in function extensions, but the 
language itself allows for anything a machine is capable of doing.




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-12  0:00   ` OBryan Anthony H
  1996-08-12  0:00     ` Bob Kurtz
@ 1996-08-12  0:00     ` Lawrence Kirby
  1996-08-13  0:00     ` Tom Watson
  1996-08-14  0:00     ` Robert Dewar
  3 siblings, 0 replies; 25+ messages in thread
From: Lawrence Kirby @ 1996-08-12  0:00 UTC (permalink / raw)



In article <4un7j3$m9g@ursa.smsu.edu>
           aho450s@nic.smsu.edu "OBryan Anthony H" writes:

>William Clodius (clodius@hotspec.lanl.gov) wrote:
>
>: Not quite. First when passed as an argument to a user defined function
>: a C array looses a lot of its distinction from a pointer, a problem
>: that many other languages do not have. Second, while (almost?) all
>
>  I have a hard time seeing this as a problem.  It's one of the fantastic 
>advantages of the C language.  An array of any given type can be passed 
>to a user function and treated as an array of any other integral type, 
>converted, processed, etc. in any manner the programmer desires.

However the results of doing so are not predictable from the language
so it is rarely if ever a useful thing to do (viewing objects specifically
as an array of char, or better still unsigned char is sometimes useful).

>: additional capabilities that C arrays lack, the ability to specify
>: array shape in arguments (Fortran I), and various forms of whole array
>: operations, APL, PL/I, Algol 68, and Fortran 90.
>
>What do you mean by array shape?  C is fully capable of performing whole 
>array operations.  The capability is not embedded in the language, as C 
>is designed to provide only the bare necessicities for program 
>development with all else being provided in function extensions, but the 
>language itself allows for anything a machine is capable of doing.

As are most other languages. However some operations are much easier
to express in some languages than others. If you want to perform a
whole array operation then that will clearly be very easy in a language
that supports appropriate whole array operations directly.

-- 
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-12  0:00   ` OBryan Anthony H
@ 1996-08-12  0:00     ` Bob Kurtz
  1996-08-12  0:00     ` Lawrence Kirby
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 25+ messages in thread
From: Bob Kurtz @ 1996-08-12  0:00 UTC (permalink / raw)



In article <4un7j3$m9g@ursa.smsu.edu>, aho450s@nic.smsu.edu (OBryan
Anthony H) wrote:

> William Clodius (clodius@hotspec.lanl.gov) wrote:
> 
> : Not quite. First when passed as an argument to a user defined function
> : a C array looses a lot of its distinction from a pointer, a problem
> : that many other languages do not have. Second, while (almost?) all
> 
>   I have a hard time seeing this as a problem.  It's one of the fantastic 
> advantages of the C language.  An array of any given type can be passed 
> to a user function and treated as an array of any other integral type, 
> converted, processed, etc. in any manner the programmer desires.

This is one of the best features of C.  This is one of the worst features
of C.  You are free to handle that passed address in any way you choose,
without substantial limitation by the language, and regardless of whether
it is sensible or whether you really meant to do it that way.  What seems
powerful when developing small programs becomes deadly when developing
large systems with many programmers.

> : additional capabilities that C arrays lack, the ability to specify
> : array shape in arguments (Fortran I), and various forms of whole array
> : operations, APL, PL/I, Algol 68, and Fortran 90.
> 
> What do you mean by array shape?  C is fully capable of performing whole 
> array operations.  The capability is not embedded in the language, as C 
> is designed to provide only the bare necessicities for program 
> development with all else being provided in function extensions, but the 
> language itself allows for anything a machine is capable of doing.

Using this argument to suggest that C provides whole-array operations is
like saying C provides for computer vision, because the machine is capable
and somebody once wrote a program ("function extensions") that did this.

In fact, there is a big difference between language-supported operations
and those "extensions" that you make by yourself.  For one, language
operations are (we sincerely hope) extremely robust and unlikely to fail. 
It takes serious measures (like good design, thorough unit and integration
testing, and preferably a history of use) to be able to make that
contention about a user-written library module.

I presume that "array shape" is the ability of a module to determine the
dimensions of an array passed as an argument.  Ada supports this (to my
great delight when I first learned about it), C does not.  That's not to
say you can't pass dimensions to the module as well, or bundle the
dimensions and the pointer to the array into a passed structure (yuck),
but it is not inherently supported by the language, and thus invites
nonstandard (even within the same project) ways of dealing with the
problem.  This, in turn, invites errors, particularly subtle ones.

So is Ada "better" than C?  Depends.  Is it "safer" than C?  Sure thing.

-Bob

-- 
Bob Kurtz (kurtz@mustang.nrl.navy.mil)
Hughes STX Corp., US Naval Research Lab, Washington DC




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
@ 1996-08-13  0:00 Spasmo
  0 siblings, 0 replies; 25+ messages in thread
From: Spasmo @ 1996-08-13  0:00 UTC (permalink / raw)



OBryan Anthony H (aho450s@nic.smsu.edu) wrote:
: William Clodius (clodius@hotspec.lanl.gov) wrote:

: : Not quite. First when passed as an argument to a user defined function
: : a C array looses a lot of its distinction from a pointer, a problem
: : that many other languages do not have. Second, while (almost?) all

:   I have a hard time seeing this as a problem.  It's one of the fantastic 
: advantages of the C language.  An array of any given type can be passed 
: to a user function and treated as an array of any other integral type, 
: converted, processed, etc. in any manner the programmer desires.

Actually it's an awful problem and it's one of the crippling problems
that plagues C.  Since an array is in many respects interchangable
with a pointer you have (once again) opened the door to the types
of disasters that C is infamous for.  I mean you can pass a pointer
to a function, and treat it like an array by accident, or vice versa.
The Ada method is much better.  There is a distinction between arrays
and pointers (hell, they aren't anywhere near the same thing), and
so when you have an array parameter in Ada, it will expect an array.
Still no flexibility is lost since you can declare types of 
unconstrained arrays which means arrays of any size can be passed,
and this of course can be combined with the generic capabilities
of Ada to give you far more flexibility than you could ever hope
to have in C, and something else you don't have in C -- safety.



: : additional capabilities that C arrays lack, the ability to specify
: : array shape in arguments (Fortran I), and various forms of whole array
: : operations, APL, PL/I, Algol 68, and Fortran 90.

: What do you mean by array shape?  C is fully capable of performing whole 
: array operations.  The capability is not embedded in the language, as C 
: is designed to provide only the bare necessicities for program 
: development with all else being provided in function extensions, but the 
: language itself allows for anything a machine is capable of doing.

I'm assuming actually having the size of the array be specified in
the parameter and checked.  In C while you can specify an array
size in a parameter, it does absolutely nothing since you are
free to overrun that size to your heart's content.  As for 
array operations, again I think he may mean doing things like
assignment and equality comparisons on arrays, something that
C again cannot do with any aggregate types.  This limitation
becomes a major pain in the posterior when you get to C++ and
generic subprograms since you end up having to code all sorts
of ugly hacks just to get many generic types to behave properly.


--
Spasmo
"Everyone has secrets, but sometimes you get caught,
 So if it's just between us, my silence can be bought"
	"Blackmail" by Sloppy Seconds





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-12  0:00   ` OBryan Anthony H
  1996-08-12  0:00     ` Bob Kurtz
  1996-08-12  0:00     ` Lawrence Kirby
@ 1996-08-13  0:00     ` Tom Watson
  1996-08-14  0:00     ` Robert Dewar
  3 siblings, 0 replies; 25+ messages in thread
From: Tom Watson @ 1996-08-13  0:00 UTC (permalink / raw)



In article <4un7j3$m9g@ursa.smsu.edu>, aho450s@nic.smsu.edu (OBryan
Anthony H) wrote:

> William Clodius (clodius@hotspec.lanl.gov) wrote:
> 
> : Not quite. First when passed as an argument to a user defined function
> : a C array looses a lot of its distinction from a pointer, a problem
> : that many other languages do not have. Second, while (almost?) all
> 
>   I have a hard time seeing this as a problem.  It's one of the fantastic 
> advantages of the C language.  An array of any given type can be passed 
> to a user function and treated as an array of any other integral type, 
> converted, processed, etc. in any manner the programmer desires.
> 
> : additional capabilities that C arrays lack, the ability to specify
> : array shape in arguments (Fortran I), and various forms of whole array

Please review your history, original Fortran didn't have subroutines!!

> : operations, APL, PL/I, Algol 68, and Fortran 90.
> 
> What do you mean by array shape?  C is fully capable of performing whole 
> array operations.  The capability is not embedded in the language, as C 
> is designed to provide only the bare necessicities for program 
> development with all else being provided in function extensions, but the 
> language itself allows for anything a machine is capable of doing.

What he would like to do (and this is not presently supported at all, and
is invalid syntax) is:

void routine (int n1, int n2, double a[n1][n2])
{
...
}

Or some such wonderful syntax.  It makes writing complex math things much
easier.  If you are living cleanly, and the compiler is verbose enough, it
might even check array bounds as well.  That is a "quality of
implementation" issue though.

-- 
Tom Watson
tsw@3do.com         (Home: tsw@johana.com)




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-12  0:00   ` OBryan Anthony H
                       ` (2 preceding siblings ...)
  1996-08-13  0:00     ` Tom Watson
@ 1996-08-14  0:00     ` Robert Dewar
  3 siblings, 0 replies; 25+ messages in thread
From: Robert Dewar @ 1996-08-14  0:00 UTC (permalink / raw)



Obryan Anthony (is this the right order?) says

"  I have a hard time seeing this as a problem.  It's one of the fantastic
advantages of the C language.  An array of any given type can be passed
to a user function and treated as an array of any other integral type,
converted, processed, etc. in any manner the programmer desires."

Nope, C, the language does not permit this, or at least says that the
semantics are implementation defined. So your C compiler may or may
not do something interesting, but you are writing highly non-portable
code if you do this. It is possible to write portable code in C, but
you have to first get rid of attitudes like this!





^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: Ada is 'better' than C because...
  1996-08-06  0:00       ` Ken Garlington
                           ` (2 preceding siblings ...)
  1996-08-09  0:00         ` Sandy McPherson
@ 1996-08-15  0:00         ` Mike Stark
  3 siblings, 0 replies; 25+ messages in thread
From: Mike Stark @ 1996-08-15  0:00 UTC (permalink / raw)



Folks --

I strongly recommend this report (see URL below), because it is the
closest thing you will ever see to a controlled experiment.  

This is because the Rational (formerly Verdix) VADS product is a mix of 
C and Ada, with the same development team working in both languages 
(because enhancement/ correction assignments were handed out for product 
features, not for individual modules.  It's been a while since I've read
it, but I believe only one relatively new employee hadn't worked in both
languages.

The conclusion was that Ada modules cost less and had lower error rates.
Again, read the report and you will see that there is strong evidence
backing up this conclusion, at least for the type of product and 
marketing environment compiler vendors live in.

URL for "Comparing Development Costs of C and Ada":
http://sw-eng.falls-church.va.us/AdaIC/docs/reports/cada/cada_art.html

Mike




^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~1996-08-15  0:00 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-13  0:00 Ada is 'better' than C because Spasmo
  -- strict thread matches above, loose matches on Subject: below --
1996-07-27  0:00 C is 'better' than Ada because Tim Behrendsen
1996-07-29  0:00 ` Ada is 'better' than C because John Herro
1996-07-30  0:00   ` Brian Rogoff
1996-07-30  0:00     ` Adam Beneschan
1996-07-31  0:00     ` Franz Kruse
1996-08-04  0:00   ` Richard Riehle
1996-08-05  0:00     ` Sandy McPherson
1996-08-06  0:00       ` Ken Garlington
1996-08-06  0:00         ` GAFFNEY.BRIAN
1996-08-07  0:00           ` Ken Garlington
1996-08-08  0:00         ` Theodore E. Dennison
1996-08-08  0:00           ` Frank Lipski
1996-08-09  0:00         ` Sandy McPherson
1996-08-15  0:00         ` Mike Stark
1996-08-07  0:00       ` Bob Kitzberger
1996-08-08  0:00       ` Robert Dewar
1996-08-08  0:00         ` Kevin D. Quitt
1996-08-08  0:00 ` William Clodius
1996-08-09  0:00   ` Robert Dewar
1996-08-09  0:00   ` Kevin D. Quitt
1996-08-12  0:00   ` OBryan Anthony H
1996-08-12  0:00     ` Bob Kurtz
1996-08-12  0:00     ` Lawrence Kirby
1996-08-13  0:00     ` Tom Watson
1996-08-14  0:00     ` Robert Dewar

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