Re: The Advantage of Macros



Betov wrote:

Herbert Kleebauer <klee@xxxxxxxxx> écrivait news:46C5E89D.A8A311D7
@unibwm.de:

No, this time I don't let you escape so easily. If you are a man
who stands to his words, one example (or further explanation) for
each statement please:

Really? You are not joking? Well...


* "EveryThing is a" ---> No !

The concept of "EveryThing is a" is abusive generalition,
and, first, anything abusive is wrong. Second "EveryThing
is a" is fascism, in matter of Programming Language, as
well as Assembly is an anarchist Language.

AFAIK, there's no "everything is a ..." concept in C.

Something that probably comes close to your allegation is the concept
of "streams". In C, all I/O is accomplished through a "stream", which is
nothing more than a source and/or sink for bytes. In this case, the
generalisation, (which is actually inherited from UNIX design, rather than
something inherent in C), has proved to be one of the main factors that
contributed to the portability of C.

* "Everything is a Procedure" ---> No !

If you do not know that this is one of the very first
predicats of C, what can i say?

That's wrong. In C, a unit of compilation, called a "translation unit",
which is usually a single source file, can consist of external declarations
and function definitions. For example:

/* ... */
int i;
struct s {
char c;
float f;
};

void fx(int *x, int *y) {
int tmp = *x;
*x = *y;
*y = tmp;
return;
}
/* ... */

In the above fragment of a translation unit, 'i' is an external declaration
of an int object that is also a definition, 's' is a declaration of a
struct type, and 'fx' is a function that swaps it's parameters.

As you can see, everything is _not_ a function in C.

* "Every Procedure returns a value" ---> No !

Same. What can i say? Did you never saw a Procedure call, in
C, in the form of:

Function (NULL);

Any function that is declared with a return type of 'void' does _not_ return
any value. Also, as your function call above shows, you can discard a
function's return value, if necessary.

* "Portability" ---> No !

Portability is pure mythology. The fact that C made its own
mythology true by pushing to the explosure of technology,
is just one another example showing that bad generates bad.

It is real. A carefully written C program can be recompiled on any supported
platform with little or no modification. Among assemblers, NASM, GAS, and
YASM are examples, particularly GAS, whose generic code portions can be
used, without modifications, on x86, Alpha, ARC, ARM, i860, i960, IA-64,
m68k, MIPS, PDP-11, PPC, Sparc, Z80, and VAX, among many others.

Also, if you think C is complicated, just take a look at languages like C++,
Java, Perl, HLA etc.

"Write-Only Notation" ---> No !

The first one who can read a C expression rises his hand up.
C pushes to wrong programming styles. At the time you write
it, you understand what you mean to say. Then, the day after,
when hunting bugs down, you cannot make any head not tail of
what you have written.

Again, this is far more true for languages like C++, Perl and even heavily
optimised assembly than C. Also consider languages like Terse, APL, PL/1
which are *far* more notorious for write-only code than C.

But here you do have a point. C can, and often is, written in an overly
cryptic fashion. That is more the fault of the programmer than that of C.

.



Relevant Pages

  • Re: Unicode
    ... > int main ... if you mean making your code translatable to different programming ... languages, you could just substitute cout with output ...
    (comp.lang.cpp)
  • Re: Need help for a code in "Numerical Recipes in C++"
    ... > For programming in languages like C, one would like to sort ... > {int j,jold,v; ...
    (sci.math.num-analysis)
  • Re: compiler for Chinese development language
    ... This relates to the development of vernacular ... Indian vernacular display, OS and programming languages. ... Bangla and other vernaculars. ...
    (comp.compilers)
  • Re: Head-in-the-Sand Liberals (LA Times Columnist)
    ... You claimed to have known several computer languages, ... If you lie about knowing computer languages, ... of the programming loop for a functional ... You also don't know Java. ...
    (rec.org.mensa)
  • Re: Is there a mainframe skills shortage?
    ... That's because the author of the article is comparing it to standard SQL. ... and material around Lamdas and functional programming. ... obvious which languages were the ones to learn. ... stick to writing system software and leave applications to the COBOL ...
    (comp.lang.cobol)

Loading