C is not superfluous (Re: "for" loops (was Re: C++ vs. Modula2))

Dave Jones djones at megatest.UUCP
Tue Jan 31 10:19:15 AEST 1989


>From article <348 at twwells.uucp>, by bill at twwells.uucp (T. William Wells):
> In article <1626 at csuna.UUCP> abcscagz at csuna.csun.edu (Jeff Boeing) writes:

> : ... a C "for" loop is superfluous
> : because it can be replaced by an equivalent "while" loop, NOT an
> : equivalent "do ... while" loop:
> 
> C is superfluous because it can be replaced by an equivalent assembly
> program.
> 

Nice try, but this reductio ad absurdum doesn't stand up under scrutiny.

I got the same response once when I observed that the functions of C++
are largely bookkeeping and keystroke-saving mechanisms, and that for 
the most part, one could write the C++ program in C, by keeping to some 
naming conventions.  (Inline procedure calls are an exception. There the
compiler is doing some semantic munging that would be impossible to
emulate in straight C.) This mortified some of the object-orientation
guys who like to use phrases like "sort-lattice inheritance polymorhism"
to describe kinds of lookup-tables. (I just made that one up. How
do you like it? ) One fellow replied that one could simply not write 
object-oriented code without an object-oriented language, and C was
not an "OOL".

I pointed out that most C++ compilers translate into C anyway, and
said, "So there."

He rejoined that if C++ were "only" a bookkeeping program,
then so was C, because C compilers translate into assembly
language. "So there. Ha!"

Indeed, many C-compilers translate to assembly language, but -- and
this is important -- not always the same one.  Thus C is a mechanism for
machine-independence. The "reductio" by analogy to replacing
C-code with an "equivalent" assembly language program just doesn't hold up.



			Dave J.


P.S.  I kind of like C++, although I think the class-initialization and
cleanup mechanisms are a little strained. The "bookkeeping" it does is 
useful, and programs with fewer characters can be easier to read. It also
kind of encourages programmers to design around data-structures rather
than algorithms, and to limit access to data-structure internals to
a few easily identified procedures.

I look forward to the day when it is available on one particular kind 
of machine that doesn't support it now. If and when that happens, I'll
probably switch over.


			D. J.


P.P.S.  I also like the C for-loop.



More information about the Comp.lang.c mailing list