From: mjs@hubcap.clemson.edu (M. J. Saltzman)
Subject: Re: Switching from Fortran to C
Organization: Clemson University, Clemson SC
Date: Sat, 12 Sep 1992 03:06:55 GMT

OK, I'll take the bait...

In article <mac.716244930@depot.cis.ksu.edu.cis.ksu.edu> mac@cis.ksu.edu (Myron A. Calhoun) writes:
>mstemper@ems.cdc.com (Michael Stemper) writes:
>>And if you really want to drive a hard-core C programmer crazy, show them
>>that their C compiler will accept this file:....

I'm not a "hard-core" C programmer (I write plenty of Fortran and I've
written my share of Pascal, PL/I, and assembler. too), but my response
to this is:

It doesn't bother me (or many C programmers that I know) in the least
that my C compiler accepts this sort of foolishness.  The crazy things
that C compilers accept are showcased annually in the International
Obfuscated C Code Contest, whose results for this year were recently
posted in comp.lang.c.  They are hilarious, and the "Fortran" example
was really kind of cute.  (After all, we're all entitled to a little
fun every now and then...)

What bothers me is when people propose to write serious code for use
by other people using these tricks.  They do nothing for readability
or (especially) maintainability.  They require a C programmer trying
to read them to learn a whole new language (even if they already know
Fortran, Pascal, or whatever language is being imitated) and they
force anyone trying to write in the dialect to learn a new language
(in addition to learning C, since you can't really understand what the
code is doing in detail without looking at the native C--especially
when it breaks), since the dialect isn't really native Fortran, 
Pascal, or whatever.

>I try to make my C programs look more like Modula 2; 

Why?

>                                                      here is a module from
>the last big C program I wrote:  the C compiler eats it up.

Yeah, but the programmer they hire to maintain the code when you're 
gone will choke on it, and so will your Modula 2 compiler.  What have
you really gained?

In the immortal words of sombody else:
	If you want Modula 2, you know where to find it.

Below is an edited sample of code in a new language called Myron:

>(#includes, #defines, most comments, & similar lines deleted for brevity)

Uh huh....

>
>------------ cut here ------------ cut here ------------ cut here ------------

OK

>   Pend_of_sequence  = &sequence[MAXSEQUENCE-1];
>   *(Plast_in_sequence = &sequence[0]) = START_SYMBOL;
>
>   FOR (X = 0; (X < MAXSYMBOLS); X++) THEN
>       implicant_counts[X] = 0;
>   END_FOR

Yep.  This really looks like Modula 2, all right.

>             FOR (length = (*Pcur_imp_node).implicant_length
>                 ,Pold_symbol = (*Pcur_imp_node).Pconsequent
>                 ,Pnew_symbol = Plast_in_sequence
>                 ,count       = 2    /* Length of shortest implicant */
>                 ;(*--Pnew_symbol == *--Pold_symbol); ) THEN

I think this is the worst of both worlds.

>------------ cut here ------------ cut here ------------ cut here ------------
>--Myron.
>-- 

-- 
		Matthew Saltzman
		Clemson University Math Sciences
		mjs@clemson.edu
Newsgroups: comp.lang.fortran