about void voids (Re: efopen
lee at haddock.UUCP
lee at haddock.UUCP
Sun Nov 24 09:08:00 AEST 1985
I think that "asm" should only be used in functions that meet both
of the following conditions.
1) The function is inherently machine-dependent, so that it would
have to be re-written to port it to a substantially different
machine.
2) The alternative to using "asm" is to write it entirely in
assembly language.
I sometimes find an alternative to condition 1) along the following lines:
1a) the function is performance sensitive and can be significantly
improved in performance on a particular architecture by insertion of
small amounts of inline assembly code.
For example, the operation performed by the IBM 370 "tr" instruction or the
VAX "movtc" instruction can replace a loop in critical sections of otherwise
ordinary C code.
In these cases, of course, the asm() directive containing FOO assembly code
should be embraced in "#if defined(foo)" and the equivalent C code compiled
for architectures for which the asm() directives are not provided.
More information about the Comp.lang.c
mailing list