From: lasner@watsun.cc.columbia.edu (Charles Lasner)
Subject: Re: The need for an assembler (was: Favorite CPU)
Reply-To: lasner@watsun.cc.columbia.edu (Charles Lasner)
Organization: Columbia University
Date: Tue, 15 Sep 1992 09:55:10 GMT

In article <Q95JNID@taronga.com> peter@taronga.com (Peter da Silva) writes:
>In article <1992Sep8.090511.15166@news.columbia.edu> lasner@watsun.cc.columbia.edu (Charles Lasner) writes:
>>In article <O7ZIWJC@taronga.com> peter@taronga.com (Peter da Silva) writes:
>>>In article <1992Aug31.050254.12657@news.columbia.edu> lasner@watsun.cc.columbia.edu (Charles Lasner) writes:
>>>>In any case, the point was made abundantly clear: there are untranslatable
>>>>features expressable only in assembler.
>
>>>Some languages allow access to any machine code instruction from quite a high
>>>level (A-Natural, the C variant on the Bellmac-32, any Forth worth using),
>>>and other high level languages allow access to any machine facility (PL/M,
>>>for example, is about the same level as C and provides direct access to all
>>>80x86 capabilities).
>
>>Yes, you can *access* the capabilities, an oversimplification is to claim
>>that BASIC can *access* *anything* using PEEK and POKE.
>
>You really have no idea what any of the languages I described other than
>C are like, do you? Apart from PL/M these are much lower level languages
>than C, but much more readable and less error prone than assembly. PL/M,
>A-Natural, and Bellmac C are not portable in the same way as C, but Forth
>is... I've written code in Forth that's run without change on HP, DEC,
>Intel, and Signetics processors. And Forth certainly qualifies as a tight
>language... most Forth programs are *smaller* than assembly equivalents.

And most are *smaller* in performance as well.  Much worse than C performance
and not likely worth the trade-off.  Interpreters in general usually suck.

Readability and error proneness aren't functions of languages per se, rather
of styles and conventions of individuals.  We've gone over that before.

>
>>But what's wrong
>>is that you have to call closed assembly-language-written functions to allow
>>certain structures to be expressed, since C doesn't have the means to
>>express the actually running code.
>
>You've never used a compiler that provided inline assembly? And applied
>optimizations to the resulting code? You can write a program in 99% C and
>still get down and dirty when you need to. When you need to. Not all the
>time because it makes you feel better.

Irrelevant to what was stated.  Unless substantially in assembler, the code
can't do certain things you want assembler for in the significent cases.  And
you wouldn't want to "in-line" that type of thing anyway; you'd write it
in assembly and link it in as a closed assembly-written routine because that's
easier.  This is not a reference to a couple line tweak here and there; that
may be another example of why occasionally assembler is needed, but it's not
all-inclusive at all.

>
>>Sloppy mathematically "equivalent" code doesn't count here.
>
>Sure it does. If it produces the same result and runs fast enough (and
>let's not get into a fight over "fast enough"... we're talking about
>a factor of a few percent in substantial programs), why doesn't it?

No it does not, because your assumption is all wrong.  Fast enough is often
a "wise-guy" approach and eventually wise-guys get their "just deserts".  The
point stands that there are people who don't grasp the concept that getting
the same answers doesn't imply the same performance.

>
>In a very few cases (interrupt handlers, other small time-critical codes
>like BitBlt or a microkernel) assembly is substantially faster. For
>anything larger, it all comes out in the wash.

Depends.  Also, who said that any of those applications are small?  What they
are is *fast* and thus the only thing small about them is the small fraction
of the machine's time spent in them.  Assembler may be doing speed/space
optimizations that make the running code huge but fast, such as many lookups
or non-subroutined code for speed, or coroutines, etc.

>-- 
>                                                                `-_-'
>                         Har du kramat din varg idag?            'U`
>
>Peter da Silva, Taronga Park BBS, Houston, TX  +1 713 568 0480/1032

cjl