Re: Asm programming capability?




"Chris M. Thomasson" <no@xxxxxxxxxxxx> wrote in message
news:_xCXl.17$mX2.6@xxxxxxxxxxxxxxx
"cr88192" <cr88192@xxxxxxxxxxx> wrote in message
news:h0kvvj$2c0$1@xxxxxxxxxxxxxxxxxxxx

"deostroll" <deostroll@xxxxxxxxx> wrote in message
news:f016ec41-74ad-4e09-ab8a-a040ae4a641f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Is the c language designed to execute assembly language instructions?

I would have to say no...

Is it in the standard?


yes and no...
the standard reserves a keyword ('asm') for use for this purpose, but
says little more on the subject.
the actual syntax of asm blocks, as well as any behavior/... they may
exhibit, is a matter left up to the implementation.

so, as a general rule, I don't use inline assembler...


going OT:
[...]

FWIW, I use inline asm and/or externally assembled libraries to create
sensitive synchronization algorithms:

http://groups.google.com/group/alt.lang.asm/msg/bec9d5ebda9441da


inline and external ASM work, just typically one has to modify their ASM
between Windows and Linux, use different Makefile for different CPUs, ...
(as well as make sure ones' preferred assembler is installed, ...).

inline asm is less of a hassle than external ASM, but then it is compiler
specific (and, in the GCC case, forces use of GAS syntax, ...). so, code
which targets both GCC and MSVC would essentially need multiple copies of
all the inline ASM...

these issues are actually what makes run-time ASM preferable in my case...

granted, there is a downside to run-time ASM:
it can't be statically linked with C code (one has to use function pointers,
....);
well, that, and needing to have a run-time assembler linked into the app,
....


between external assembler and inline assembler, I prefer external
assembler...
now, if gcc's inline assembler was like Borland's or Microsoft's inline ASM
(AKA: much nicer looking, and Intel syntax), I would probably use inline
ASM...

or such...



.



Relevant Pages

  • Re: Possible to inline this code?
    ... With Inline code Pascal ... I'm thinking of macros in assembler; ... mov ax,inw ... {do asm stuff here} ...
    (comp.lang.pascal.borland)
  • Re: How to call function from driver in inline assembler
    ... In this product inline assembeler is used only in several functions, ... that inline asm will not be supported by 64-bit compiler. ... but with all the driver issues floating around with Vista ... What assembler reference are you using in writting inline _asm code on ...
    (microsoft.public.development.device.drivers)
  • Re: Asm programming capability?
    ... me use externally assembled asm on the rare occasions I need it. ... probably use inline ASM... ... my compiler doesn't really support inline ASM at present... ... That's what the Assembler is for, ...
    (comp.lang.c)
  • [patch] measurements, numbers about CONFIG_OPTIMIZE_INLINING=y impact
    ... gcc _does_ have a perfectly fine notion of how heavy-weight ... an "asm" statement is: just count it as a single instruction (and count ... I doubt that it's the inline asm that was the biggest reason ... size increase/decrease of the core kernel, ...
    (Linux-Kernel)
  • Re: How to call function from driver in inline assembler
    ... Inline assembler doesn't support any of the meta-directives like macros. ... What assembler reference are you using in writting inline _asm code on ... of calling through it. ... In C case, there is indirect call, instruction is 6 byte and begins ...
    (microsoft.public.development.device.drivers)