Keil Logo

C51: COMMENTS IN ASSEMBLY BLOCKS


Information in this article applies to:

  • C51 All Versions

SYMPTOM

When I try to place a comment in an assembly block or inside a C source file, such as:

#pragma asm
        mov R1, A  ; save function's return value
#pragma endasm

The compiler generates an error, thinking the apostrophe is a single quote.

CAUSE

Inline assembly code is parsed by the C compiler (which does not recognize the semicolon as the beginning of a comment).

RESOLUTION

Comments in ASM blocks should use C comment syntax. The example above compiles if changed to the following:

#pragma asm
        mov R1, A  // save function's return value
#pragma endasm

SEE ALSO

Last Reviewed: Tuesday, May 24, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.