Re: Private variables question



Phill Harvey-Smith laid this down on his screen :
Hi,

This is more from a mater of interest than any technical reason, but there seems to be a lot of code around where the private variables are called FSomething e.g.

TYPE TSomeType=class(object)
PRIVATE FLocalVar : INTEGER;
PUBLIC
PROPERTY LocalVar : INTEGER READ FLocalVar;
END;

What I guess i'm asking is why prefix it with 'F' ? I have been tending to use 'Pr' in my own code for Private, I guess the compiler does not care, just wondered why it seemed to be a convention ?

Cheers.

Phill.

As every body said it is F from Field.

Me on the other hand I couldn't care less what the prefix is (finally) I just use the auto complete feature of the IDE which auto prefix the private members with F and it doesn't give me an option which I can change it. So it is easier to type
property Count : integer; CTRL+SHIFT+C
and let the IDE create the private variable for me along with the setter method and let it at that.

Regards
Yannis.

--
If you can't get rid of the skeleton in your closet, you'd best teach it to dance.
- George Bernard Shaw (1856-1950)


.



Relevant Pages

  • Re: Private variables question
    ... there seems to be a lot of code around where the private variables ... What I guess i'm asking is why prefix it with 'F'? ... I've also gotten into the habit of prefixing local variables with L. ... This isn't so much to make them easier to spot, ...
    (borland.public.delphi.non-technical)
  • Re: underscore prefix
    ... This is olb naming convention for private variables. ... convention you should use m_ as prefix for private members ... > explanation for the reason for this. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: underscore prefix
    ... > I think the guidlines actually discourage use of m_ when it says "Do ... >>This is olb naming convention for private variables. ... >>convention you should use m_ as prefix for private members ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: underscore prefix
    ... not apply a prefix to field names or static field names." ... >This is olb naming convention for private variables. ... >convention you should use m_ as prefix for private members ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Private variables question
    ... there seems to be a lot of code around where the private variables are ... I just use the auto complete feature of the IDE which auto prefix the ...
    (borland.public.delphi.non-technical)