Comment with multiline symbol and code generation
If you have a comment which happens to end with a multiline symbol '\', the code for the subsequent statement is not generated. I'm not a gcc expert but it seems odd that this would happen.
Compiler: Crossworks for ARM
Version: 2.0.4.2009110400.6059
Code Sample (also attached):
// Multiline bug test code
#include <cross_studio_io.h>
int main()
{
volatile int viFoo;
viFoo = 1;
debug_printf("ViFoo = %d\n", viFoo);
viFoo = 2;
debug_printf("ViFoo = %d\n", viFoo);
viFoo = 1 +\
2 +\
3;
debug_printf("ViFoo = %d\n", viFoo);
// viFoo = 1 +\
viFoo = 2 +\
2 +\
3;
debug_printf("ViFoo = %d\n", viFoo);
return(0);
}
Output:
ViFoo = 1
ViFoo = 2
ViFoo = 6
ViFoo = 6
I expected the last statement to be a 7. I looked at the test.elf file and no code was generated for the statement following: // viFoo = 1 +\
/attachments/token/0b1spe716v0iguu
-
That's normal. "//" means "this is a comment, until the end of the line". "\" means "this line does not end here, it continues. Thus, the following line is a part of the comment. That's *exactly* what's supposed to happen. If your editor does colour-context, it should show the second line as comment-coloured.
Please sign in to leave a comment.
Comments
3 comments