Symbols and Labels in SH-4 Inline Assembly (Windows CE 5.0)

Send Feedback

A symbol or identifier consists of a sequence of letters and digits.

The first character must be a letter.

The compiler treats the underscore character _ as a letter.

Symbols are names supplied by programmers for variables, functions, and labels in a program.

No symbols, except labels, can be defined using inline assembly language. In addition, C/C++ symbols defined outside of __asm statements cannot be referenced from within __asm statements.

A label is a symbol attached to an assembly source statement. A label is written with a (:) appended to the end of the symbol.

The following code example shows how to use a label in an __asm block.

__asm("label1:"); //label1 is a label
__asm("label2"); //label2 is invalid. Does not terminate with a colon

Labels within __asm strings are case-sensitive. Reserved words such as register names and operation names are treated as case-insensitive.

By default, labels defined in inline assembly have a file scope. If you want to create labels with function scope, simply add 'L_' or '?' at the beginning of the label name. The inline assembler then treats it as a local label.

The following code example shows how to define a local label.

__asm("L_label1:"); // L_label1 is a local label
__asm("?label2"); // ?label2 is a local label
__asm("label3:"); // label3 is not a local label

See Also

Elements of the SH-4 __asm Block

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.