I tested C code and came across this weird compiler error
The following code will not compile
#include<stdio.h> void main() { int length=6; __asm { mov eax,length } }
Visual Studio reports the following error
test.c(7) : error C2400: inline assembler syntax error in 'second operand'; found 'newline'
However, I noticed that if I changed the variable name to something else, say lengths , then everything was fine, the following code compiles without difficulty
#include<stdio.h> void main() { int lengths=6; __asm { mov eax,lengths } }
I tried with other compilers such as Digital Mars and Intel Compiler, but everywhere the first code cannot be compiled.
What could be the problem? Is there another definition for length elsewhere.
I would also like to add that this is a single file, not a project, so there can be no multiple declarations.
c visual-c ++ compiler-errors
Extreme coders
source share