"Byte" 和 "byte" 有什么区别?

What is the difference between "Byte" and "byte"?

我可以使用以下方法定义一个字节:

a:  byte; 

也可以定义如下:

a:  Byte; 

以上两种情况编译器都会通过,但是byteByte有什么区别呢?

完全没有区别。所有版本的 Pascal(包括 Delphi 和 Free Pascal)都不区分大小写(只有极少数例外 - 见下文),因此您可以使用以下任何版本 - 它们完全相同。

a: byte;
a: Byte;
a: bYTe;
A: bytE;
A: BYTe;

Delphi 区分大小写的地方很少,H2365 Override method %s.%s should match case of ancestor %s.%s 的文档中描述了这些特定的例外情况:

Here are some situations in which Delphi is case-sensitive:

Unit References and the Uses Clause

In unit declarations and uses clauses, unit names must match the file names in case. In other contexts (such as qualified identifiers), unit names are case insensitive. To avoid problems with unit references, refer to the unit source file explicitly:

uses MyUnit in "myunit.pas";

Registering components

When you write your own components and you want to register them, the register function that you declare must be written like this:

procedure Register;  <<-- Leading capital required.  

The name of the Register procedure is case-sensitive for design-time packages. If you declare a register procedure (lower-case), and even if hint H2365 is not emitted, you do not get the expected result; your component does not get registered. For more information, see Using the RegisterComponents Procedure.

Importing external functions

When importing external functions, the exact case used in the DLL must be preserved.