Li Wei's <inside VCL>. The first console in the first chapter of the book contains the following function declaration:
Function windowproc (window: hwnd; amessage: uint; wparam: wparam; lparam: lparam): lresult; stdcall; export;
I don't know if you have thought of a problem. In Delphi, It is case-insensitive. That is to say, the variable name and type name in the Declaration are the same. when we were learning Pascal, C/C ++, the teacher often told us that we could not use keywords as variable names. Why can we use them here?
I was confused when I saw this, so I checked dephi7's <Delphi language guide> and finally found the answer: the difference between the reserved words and the keywords (Reserved Words.
As mentioned in <Delphi language guide>, the following reserved words cannot be redefined or used as identifiers. That is to say, keywords cannot be used as variable names. The description of reserved words in the book is as follows:
Directives are words that are sensitive in specific locations within source code. deriectives have special meanings in the Delphi language, but unlike reserved words, appear only in contexts where user-defined identifiers cannot occured. heance-although it is inadvisable to do so-you can define an identifier that looks exactly like a directive. that is to say, reserved words can be used as variable names.
This explains why WParam: WPARAM; is allowed in the previous function declaration. by the way, Li Wei explained on the 31st page in the book <Inside VCL> that "C/C ++ Builder uses the keyword message to distribute window messages for better execution efficiency.... ", the keyword here should be changed to reserved words, because Message is reserved words rather than keywords. when we read the source code of VCL, we can often see that Message is used as the variable name.