Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual C++
C/C++ Languages
Inline Assembler

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.Net Framework 3.5

Other versions are also available for the following:
Visual C++ Language Reference
Using C or C++ in __asm Blocks

Because inline assembly instructions can be mixed with C or C++ statements, they can refer to C or C++ variables by name and use many other elements of those languages.

An __asm block can use the following language elements:

  • Symbols, including labels and variable and function names

  • Constants, including symbolic constants and enum members

  • Macros and preprocessor directives

  • Comments (both /* */ and // )

  • Type names (wherever a MASM type would be legal)

  • typedef names, generally used with operators such as PTR and TYPE or to specify structure or union members

Within an __asm block, you can specify integer constants with either C notation or assembler radix notation (0x100 and 100h are equivalent, for example). This allows you to define (using #define) a constant in C and then use it in both C or C++ and assembly portions of the program. You can also specify constants in octal by preceding them with a 0. For example, 0777 specifies an octal constant.

Reference

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker