Portable "asm" (Was: The D Programming Language)
John Sambrook
john at uw-nsr.UUCP
Tue Mar 15 18:10:29 AEST 1988
In article <1092 at PT.CS.CMU.EDU> edw at IUS1.CS.CMU.EDU (Eddie Wyatt) writes:
>> [someone else]
>> 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?
>
>To which the obvious reply is speed - functions invocation can be
>RELATIVELY expensive. The time taken to invoke a subroutine may
>out way any gains that the asm statement made. Disclaimer - I don't use
>asm - don't plan on it either.
If performance is critical write the whole subroutine in assembler,
not just the innermost loop. Of course, those people who have
"subroutines" that span 10+ pages will whine about it being "too
much work."
Further, consider that on many systems the conventions for inter-
language calling are spelled out in the system documentation and
users are advised to conform to the standard. Vendors agree not to
change the standard indiscriminately. However, the code generated
by a given compiler is under no such obligation and likely to change
whenever a new revision of the C compiler is installed.
Maybe other people have different priorities than I do. I'd
consider it a tremendous waste of time to run around fixing programs
that quit working just because I installed a new version of the
C compiler.
"If it looks like a hack, feels like a hack, smells like a hack ...
it's a hack."
Is anyone else wondering if Herman Rubin and Doug Pardee are related? :-)
--
John Sambrook Internet: john at nsr.bioeng.washington.edu
University of Washington RC-05 UUCP: uw-nsr!john
Seattle, Washington 98195 Dial: (206) 548-4386
More information about the Comp.lang.c
mailing list