Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!unmvax!ncar!tank!nic.MR.NET!shamash!nis!ems!rosevax!orbit!pnet51!shawn
From: shawn@pnet51.cts.com (Shawn Stanley)
Newsgroups: comp.lang.c++
Subject: Re: Assembly or ....
Message-ID: <318@orbit.UUCP>
Date: 29 Nov 88 20:45:14 GMT
Sender: root@orbit.UUCP
Organization: People-Net [pnet51], Minneapolis, MN.
Lines: 40

jima@hplsla.HP.COM (Jim Adcock) writes:
>> >I don't agree that there is ever any necessity to code in assembler. We
>> >have languages that produce code just as good as hand crafted assembler
>> >(such as C), so why not use them for this sort of thing.
>> 
>> Ah, but wouldn't that be nice.  Optimizing compilers that could generate
>> code as good as we can generate by hand in all cases.  Let me know when
>> someone writes one.
>
>Well, I have seen optimizing compilers that generate code as good as can
>be coded by hand when:-)
>
>1) The person writing the C code knows C.
>2) The person writing the C code know the capabilities and limitations
>      of his/her optimizing compiler.  IE you know what assembly it's
>      going to generate.
>3) The person writing the C code know the capabilites and limitations
>      of the underlying hardware.

Ah, but I've never used an optimizing compiler that could take advantage of
processor flags that logically must be set a certain way from a previous but
related operation and avoid checking something more than once, while I'll take
full advantage of such conditions when coding by hand.

It may just be the compilers I've used (two MS-DOS compilers, one SCO Xenix
compiler, and two Apple II compilers), but that in itself should be enough to
point out that while there very well may be optimizing compilers that
"generate code as good as can be coded by hand", it's not the rule of thumb in
the marketplace.

However, I've written device drivers with MS-DOS and considering the overhead
involved, I'd rather write them in assembly, which I have.  But with
Unix/Xenix, I've found that writing device drivers in C is much easier.

I will say this.  Knowing assembly has helped me immensely, but I would never
say that assembly is always necessary.  Neither would I say it is to be
ignored.  It has its place...

UUCP: {rosevax, crash}!orbit!pnet51!shawn
INET: shawn@pnet51.cts.com