
0
Answered
Should public fields really start with F?
Currently code like this generates the warning C107 Class field name should start with 'F':
type
TSomeClass = class
private
FSomeField: integer;
procedure SetSomeField(_Value: integer);
public
SomeOtherField: integer; // <- C107 here
property SomeField read FSomeField write SetSomeField;
end;
I question whether there should actually be a warning. Isn't it common practice to have some fields of a class publicly accessible and then not prefix them, so, if need arises, one could simply replace them with a property that has a getter and/or setter method without having to change code that accesses it?
type
TSomeClass = class
private
FSomeField: integer;
procedure SetSomeField(_Value: integer);
public
SomeOtherField: integer; // <- C107 here
property SomeField read FSomeField write SetSomeField;
end;
I question whether there should actually be a warning. Isn't it common practice to have some fields of a class publicly accessible and then not prefix them, so, if need arises, one could simply replace them with a property that has a getter and/or setter method without having to change code that accesses it?
Answer

0
Answer
Answered
Roman 10 years ago
I agree. This rule should ignore public fields.
Customer support service by UserEcho