0x6B6F77616C74
0x6B6F77616C74

Reputation: 2629

Letter "c" as variable name

Purely from curiousity - why it's impossible to name the variable "c"? For example...

.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

... this causes an assembling-time error

C:\3-rd party programs\winASM\WinAsm\Projects\quadratic equation\EXE.asm(24) : error A2008: syntax error : c
C:\3-rd party programs\winASM\WinAsm\Projects\quadratic equation\EXE.asm(52) : error A2008: syntax error : c

When I rename it, everything assemblies and runs well.

Upvotes: 2

Views: 770

Answers (1)

panda-34
panda-34

Reputation: 4209

Try naming your variable PASCAL, FORTRAN, BASIC, SYSCALL or STDCALL. I believe, you'll get the same error. They're all keywords that specify calling conventions for procedures should you happen to use those written in the aforementioned languages. The valid usage of C keyword would be like funcname PROTO C arguments...

Upvotes: 3

Related Questions