0
Answered

Should public fields really start with F?

dummzeuch 10 years ago updated by Roman 10 years ago 1
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?

Answer

Answer
Answered
I agree. This rule should ignore public fields.
Answer
Answered
I agree. This rule should ignore public fields.