lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, May 20, 2005 at 12:28:55AM +1000, David Burgess wrote:
> In summary I cannot find a valid way to use the braced sybtax.

The VC docs suggest that each assembly instruction in braces has to be
on its own line.  When you use escaped newlines in C, those newlines
are removed during translation phase 2 (very early on).  So:

  __asm { \
    fld d \
    fistp i \
  }

becomes:

  __asm {     fld d     fistp i   }

before the compiler even gets around to tokenizing the input for
preprocessing.  I'm not aware of any way to get multiple lines of code
out of a macro, since the #define statement itself requires the macro
definition to be a single line.  You could probably make it work with
a C99-style inline function instead of a macro.

The other #define technique:

  __asm fld d \
  __asm fistp i

works even though it's a single line, because VC apparently has
special handling for __asm when it appears multiple times on the same
line.

                                                  -Dave Dodge