Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!lll-crg!brooks From: brooks@lll-crg.UUCP Newsgroups: net.lang.c Subject: Re: Compiler Specific Operators Message-ID: <3519@lll-crg.ARpA> Date: Sat, 12-Jul-86 20:03:20 EDT Article-I.D.: lll-crg.3519 Posted: Sat Jul 12 20:03:20 1986 Date-Received: Sat, 12-Jul-86 23:19:50 EDT References: <1825@uw-beaver> <5780@alice.uUCp> Reply-To: brooks@lll-crg.UUCP (Eugene D. Brooks III) Organization: CRG, Lawrence Livermore Labs Lines: 24 >C already has a hook for such things. It's called the "asm" statement. >Despite its name, there is no law that says that what follows "asm" >must in fact be assembly language. If you're writing the compiler, >you can implement whatever syntax you like with whatever semantics you like. It would be nice if asm was more "printf like" instead of just dumping a string. I have made quite a lot of use of asms when writing things like multitasking packages and other things which need assembler hooks. Most of the code can be in C and be reasonably portable. I have often needed the ability to stick a stack address in an asm without knowing just what stack address you want to load... ie suppose you want to change the stack pointer... char *oldpointer; char *newpointer; asm("store sp,%a", oldpointer); asm("load sp,%a", newpointer); The code is machine dependent, but the compiler takes care of the C name -> AS name mapping for you. Of course I guess the compiler should not encourage such screwing around.