Portable "asm" (Was: The D Prog

mcdonald at uxe.cso.uiuc.edu mcdonald at uxe.cso.uiuc.edu
Sun Mar 13 01:39:00 AEST 1988


/* Written  4:42 pm  Mar  7, 1988 by boemker at hpfcdc.HP.COM in uxe.cso.uiuc.edu:comp.lang.c */
/* ---------- "Re: Portable "asm" (Was: The D Prog" ---------- */
Since the interface between C and in-line asm seems to be so
problematic (not to mention non-portable), why not write
those routines that should be written in assembly in assembly?

(Please don't tell me about needing just a rotate here or there
for performance; reconsider the original partitioning of the task
and find an alternative that separates the high-level part and
the low-level part.)

(Yes, I have written separately compiled assembly routines, and
I have repartitioned tasks to find an aesthetically appealing,
efficient alternative.)

Tim Boemker
/* End of text from uxe.cso.uiuc.edu:comp.lang.c */

I agree that having an "asm" statement is C is sufficiently unesthetic
that trying to get it into ANSI C is not a worthwhile crusade. What I
do consider worthwhile is for compiler vendors to have some way to do it.
Requiring subroutines for assembly defeats a major part of its
usefulness, which is efficiency. Most certainly, one can get that speed
by coding big hunks in assembler. But sometimes, I need just one or
two instructions in assembler. For example, on an IBM PC one frequently
needs to issue INT instructions, with certain values in registers, or
to issue INP or OUP instructions. Both major C compilers for the PC,
Turbo and Microsoft 5.00 DO have a mechanism for doing this. Microsoft
has some inline functions for common things, and , as the ultimate ability,
it will emit complete, legal, MASM code whcih you can diddle to your
hearts content. Turbo seems to HAVE "asm", though I haven't used it 
myself. If all compiler vendors were so nice, there would be no discussion.



More information about the Comp.lang.c mailing list