I'm much more productive in Perl than I ever could be in C, and Perl is far 
from my favorite language. Further, my Perl code is at least as portable as 
anything I've ever seen in C.

I would expect those who have programmed in Ada, Python or Ruby to say similar 
things, although Ruby is certainly not as portable as Perl.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List <[email protected]> on behalf 
of Bernd Oppolzer <[email protected]>
Sent: Thursday, January 25, 2018 1:57 PM
To: [email protected]
Subject: Re: Fair comparison C vs HLASM

Am 25.01.2018 um 14:34 schrieb Martin Ward:
> On 25/01/18 12:53, Tom Marchant wrote:
>> You can't find any of the more than 1100 instructions in the
>> z/Architecture instruction set that are more powerful than any C
>> language constructs?
>
> ISO C includes a construct for inline assembler: so in terms
> of individual instructions, C is as powerful as assembler.
>
> On 25/01/18 04:54, Paul Raulerson wrote:
>> In fact it optimized it so much it simply generated a LHI of a
>> register with 100000000 in it.
>
> This is an extreme example, of course, but consider the more
> usual case of a loop or loops which could be optimised
> by strength reduction, code motion, fusion, fission, permutation,
> unrolling, inversion, splitting, peeling, tiling,
> unswitching, etc. etc. As an assembler programmer,
> do you write the optimised version of the loop
> (which will be hard to understand and maintain)
> or the readable version of the loop (which may have
> very poor performance)? As a C programmer, there is no problem:
> you write the most readable and maintainable version
> of the loop and allow the optimiser to generate efficient code.
>

I would like to add:

Mainframe ASSEMBLER IMHO is the only Assembler language
(or the only instruction set) where humans can write reasonably programs
in.
All other Assemblers or instruction sets lack the same user friendliness
and orthogonality that this platform has from the early days of the 360
system.
If you look around, there aren't much programmers doing Assembler
on other platforms. All the embedded stuff is programmed using C or
C++ or other languages ... because the instruction sets are so weird.
Only on the mainframe Assembler coding is fun.

So: if you want to be really portable, you HAVE NO OTHER CHOICE
but to use C, even if you like ASSEMBLER on the mainframe
(like me, for example). Of course, it would have been a nice
experience, writing my XML parser in Assembler, but I wrote it
in C ... and I could from the beginning support all relevant platforms.
Or my Pascal compiler: it is written in Pascal; only the runtime on
the mainframe is written in ASSEMBLER (to much of it, for my taste;
I will change that, as soon as I have time to do it). On the other
systems, the runtime etc. is written in C.

BTW: I know of an old PL/1 compiler (Multics), which did the same
loop unrolling and outperformed ASSEMBLER programmers this way;
my example goes like this:

SUM = 0;
DO I = 1 to 10000;
    SUM = SUM + I;
END;
PUT SKIP DATA (SUM);

all variables BIN FIXED (31)

the compiler omitted the loop and the computation completely
and simply printed the result.

Sometimes, when I look at the ASSEMBLER or machine code the
compiler generates out of my C coding (especially when the
compiler omits certain C statements completely or moves them
out of the loop), I realize what I should have coded instead
from the beginning :-)

Kind regards

Bernd

Reply via email to