纯粹是出于好奇 - 为什么不可能将变量命名为“c”?例如......
.386
.model flat, stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib
Main proto
.data
hOutput dd 0
hInput dd 0
bReadWritten dd 0
szText db "Program calculates the roots of the quadratic expression ax^2+bx+c",10,"Enter a",0
a dd 0
b dd 0
c dd 0
delta dd 0
szInput db 128 dup(0)
.data?
.code
start:
Invoke Main
Invoke ExitProcess,0
Main proc
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hOutput, eax
invoke GetStdHandle,STD_INPUT_HANDLE
mov hInput, eax
invoke lstrlen, addr szText
invoke WriteFile, hOutput, addr szText, eax, ADDR bReadWritten, NULL
invoke ReadFile, hInput, a, eax,addr bReadWritten, NULL
invoke ReadFile, hInput, b, eax,addr bReadWritten, NULL
invoke ReadFile, hInput, c, eax,addr bReadWritten, NULL
invoke Sleep,10000
ret
Main endp
end start
...这会导致装配时错误
C:\ 3-party party program \ winASM \ WinAsm \ Projects \ quadratic equation \ EXE.asm(24):error A2008:语法错误:c
C:\ 3-party party program \ winASM \ WinAsm \ Projects \ quadratic equation \ EXE.asm(52):error A2008:语法错误:c
当我重命名它时,所有程序集都运行良好。
答案 0 :(得分:2)
尝试命名变量PASCAL
,FORTRAN
,BASIC
,SYSCALL
或STDCALL
。我相信,你会得到同样的错误。
它们都是指定程序调用约定的关键字,如果碰巧使用上述语言编写的那些。 C
关键字的有效使用方式与funcname PROTO C arguments...