Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!pyramid!oliveb!sun!gorodish!guy From: guy@gorodish.UUCP Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: Inline assembler in Microsoft C ???? Message-ID: <21211@sun.uucp> Date: Tue, 16-Jun-87 13:32:53 EDT Article-I.D.: sun.21211 Posted: Tue Jun 16 13:32:53 1987 Date-Received: Thu, 18-Jun-87 02:30:04 EDT References: <608@zen.UUCP> <2299@hoptoad.uucp> Sender: news@sun.uucp Lines: 40 Xref: utgpu comp.sys.ibm.pc:4251 comp.lang.c:2366 > >asm(""); > > Isn't this spo'sta be apart of the "Standard C". I seem to remember > it being metioned in the K&R. It is absolutely NOT supposed to be in standard C! 1) One could imagine an implementation of C on a machine with no "assembly language". 2) Not all C compilers generate assembly language; it may be very tricky to generate in-line assembly language with some of them. 3) Not all C compilers handle this in the same fashion. The VAX compiler, and a lot of other compilers, have the syntax asm(string); and just squirt the string into the generated code at that point, *verbatim*. Others permit you to define in-line "functions" that take arguments, and have different code generated depending on the addressing mode used to refer to the arguments; in these versions, "asm" is used in the *declaration*, and the "function" is *used* just like a regular function. 4) Standardizing this would have minimal effect on portability, as should be obvious. 5) The only place in the Reference Manual portion of K&R (the only part that counts when talking about "Standard C") where "asm" is mentioned merely states that some implementations reserve "asm" as a keyword - not that all of them do, and not that all of those that do use it in the same way. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com