Bug in 4.[12] BSD C compiler with "asm" statement

greg at sdcsvax.UUCP greg at sdcsvax.UUCP
Tue Jul 17 09:38:14 AEST 1984


The reason that this happens is that the "asm" statement is effectivly
processed at the lexical level and just dumped into the output file.
It would work correctly if the "asm" statment were turned into a
semi-colon, have that processed, and THEN drop it into the output.
This is the reason for the common hack to always preceed the "asm"
statement by a semi-colon.  In fact, if pre-processor substitution
worked the way the C standard will have it (where a substituted macro
loses its meaning during the evaluation; see the parallel discussion
in net.unix-wizards), using
#define asm ;asm
would cause it to work in all cases -- at least I can't think of any
where it wouldn't.
-- 
-- Greg Noel, NCR Torrey Pines       Greg at sdcsvax.UUCP or Greg at nosc.ARPA



More information about the Comp.lang.c mailing list