Keil Logo

GENERAL: STRANGE ERRORS WITH IN-LINE ASSEMBLER CODE


Information in this article applies to:

  • C51 All Versions
  • CX51 All Versions
  • C251 All Versions
  • C166 All Versions
  • CARM All Versions

QUESTION

I am using the following in-line assembler statements, but I get:

void myfunc (void) {
#pragma ASM
; My comment in assembler
  mov a, #0   ; I'm using another comment
#pragma ENDASM
}

When I compile this code I get error messages like:

*** ERROR C305: unterminated string/char const

What can be the reason for this error?

ANSWER

Even in in-line assembler sections, you need to use the ANSI C style for comments. When you re-write your program as shown below everything will compile as expected:

void myfunc (void) {
#pragma ASM
/* My comment in assembler */
  mov a, #0   // I'm using another comment
#pragma ENDASM
}

Last Reviewed: Friday, November 12, 2004


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.