Please use the "this"-Pointer in your classes!

Hello,

I’m a “NewBe:wink: in Haiku programming (but not in C++) and looking for a little piece code to take my little part to this great projekt.

I’ve looked into the SVN-Repository and have seen that nobody uses the “this” pointer for class members and/or member functions.

I know that it is not needed by c++. By using the "this" keyword coders can see at one glance if the variable / function a direct member or an locale variable and rexpectively an external variable.

What do you think?

PS: sorry for my bad english! :oops:

We’re lazy. It does not have much value and takes longer to write.

wkornew wrote:
We're lazy. It does not have much value and takes longer to write.

Plus, following our guidelines lets class members variable show up already.

Jack Burton wrote:
wkornew wrote:
We're lazy. It does not have much value and takes longer to write.

Plus, following our guidelines lets class members variable show up already.

Oh yeah, class members begin with an ‘f’. E.g.: fValues. No need for “this”. Thanks Stefano (Jack?). I hope that is your real name. :wink:

Glad to hear some type of convention is being used to make the code a little easier to read. Using this does make code easier to understand, but 4 charaacters in front of your variables starts to look ugly and can start having the reverse effect. I like the _classVariable convention, but I guess fClassVariable works too!

in fact it’s not ‘fClassVariable’ but just fVariable. Every ‘fXxxx’ variable namespace is reserved to class variable members. For example, we’ve many fEnable[d] variable members in many classes…

PS: don’t ask me why ‘f’ and not any other letter, I dunno myself…

I think the f stands for field. At least I think that’s why Borland uses it in thier classes. I’ve always preferred f_ for data members myself.

just my $.02; no change given :slight_smile: