C official DOD langauge?

brnstnd at stealth.acf.nyu.edu brnstnd at stealth.acf.nyu.edu
Wed Jun 6 21:32:28 AEST 1990


In article <1631 at dinl.mmc.UUCP> noren at dinl.UUCP (Charles Noren) writes:
> C Advantage list:
>  3.  Data Pointers.  Reduces need to copy data which helps
>      make code faster, allows for reentrant/recursive code,
>      and the declaration of structures that can be "overlaid"
>      on memory (useful, for instance, in memory-mapped I/O).

It's the stack, not the existence of pointers, that allows recursive
calls.

> C Disadvantage list:
>  4.  The Fortran language is designed so that compilers
>      can make useful assumptions for code optimization,
>      which cannot be made for C compilers.  Two examples:
>       a.  Aliasing is not permitted in Fortran.

As has been well hashed out in comp.lang.misc, a slightly intelligent
compiler can get around this ``disadvantage'' of C, even within the
compile-link model. I don't know of any compilers that do so.

>       b.  The C for statement does not have a well defined
>           "control variable" and thus cannot be automatically
>           vectorized.

The Convex compiler automatically vectorizes loops; I don't know about
the Cray UNICOS compiler.

>  5.  Array subscripts in C must start with zero, which for
>      some is counter intuitive

But with pointers, or even with simple macros, you can trivially get
around this ``restriction.'' After #define b (&a[0] + 3), b can be used
as an array of the same size as a, starting from -3. (Hmmm: is it
guaranteed by ANSI that &a[0] - 1 + 1 equals a?)

---Dan



More information about the Comp.lang.c mailing list