Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pacbell!att-ih!ihnp4!inuxc!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.lang.c Subject: Re: Portable "asm" (Was: The D Prog Message-ID: <225800012@uxe.cso.uiuc.edu> Date: 12 Mar 88 15:39:00 GMT References: <5080022@hpfcdc.HP.COM> Lines: 32 Nf-ID: #R:hpfcdc.HP.COM:5080022:uxe.cso.uiuc.edu:225800012:000:1765 Nf-From: uxe.cso.uiuc.edu!mcdonald Mar 12 09:39:00 1988 /* Written 4:42 pm Mar 7, 1988 by boemker@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.