Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.16 $; site ISM780B.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!ISM780B!tim From: tim@ISM780B.UUCP Newsgroups: net.lang.c Subject: Re: Re: Re: about void voids (Re: efopen Message-ID: <25500122@ISM780B.UUCP> Date: Thu, 21-Nov-85 18:46:00 EST Article-I.D.: ISM780B.25500122 Posted: Thu Nov 21 18:46:00 1985 Date-Received: Sun, 24-Nov-85 07:19:46 EST References: <284@3comvax.UUCP> Lines: 47 Nf-ID: #R:3comvax:-28400:ISM780B:25500122:000:1455 Nf-From: ISM780B!tim Nov 21 18:46:00 1985 > One thing which many Unix compilers support is the 'asm' statement, that is: > proc() > { > asm("mov r0, r1"); > } . . . > I'd sure like to see someone defend this particularly disgusting > (but supported on our 4.1bsd system) "feature"! On the vax it is disgusting, because you can't do much unless you know how the compiler works. But some implementations of asm make it quite useful. For example, in Megamax C for the Macintosh, the asm statement works like this: asm { stuff }; /* don't remember if the ; is needed here */ Within the stuff, one may use the following constructs ( substitute your favorite instruction for "move" ) move foo, bar /* like C bar = foo; foo,bar are global */ move a6@(foo),a6@(bar) /* like above, but foo,bar local */ move d7,d6 /* foo and bar are first and second register variables in this function */ So I can write assembly code and access all my C variables. This has several advantages: 1. I don't need an assembler. I can just use C. Plus I get to use the C preprocessor on my assembly files this way. 2. I can profile my C programs ( they provide a profiler ), and rewrite the slow parts in inline assembly in a convienient and efficient way. 3. When doing assembly stuff, I can keep C control flow. Of course, this is machine dependent... Tim Smith ihnp4!cithep!tim ima!ism780!tim