Poll rhymes with troll.
I'm not calling the OP a troll, but do we ever actually have polls on this site that are anything other than invitations to silly, argument threads? I really don't see the point in the poll functionality on the new site.
[C++] Which prefix do you use for member variables?
Start a poll about getting polls removed? I agree, overwhelmingly polls are used for things that are either personal stylistic choices, or things that would really need more discussion than a popularity contest.
I don't use any sort of prefix for member variables. I suspect this may be because I use PHP more often than anything as of late, and it requires that you use $this-> syntax to access class members. Since you have to do that, what's the point of adding m or m_ to a variable name?
Of course C++ or the like is a different story, but learned habits are hard to break. I don't like to use prefixes anyway because they offend my stylistic sensibilities. I suppose it does add some information at a glance, but it's not a habit I've managed to convince myself was worth the trouble to get into.
Of course C++ or the like is a different story, but learned habits are hard to break. I don't like to use prefixes anyway because they offend my stylistic sensibilities. I suppose it does add some information at a glance, but it's not a habit I've managed to convince myself was worth the trouble to get into.
I don't use any prefixes, I just have VAX setup to bold names in local scope.
All the colour coding and type face changes make 'at a glance' things easy to spot and aid in my ability to read the code quickly
All the colour coding and type face changes make 'at a glance' things easy to spot and aid in my ability to read the code quickly
When I see prefixes, especially when indicating type, I get an involuntary (and unpleasant) flashback to using MFC.
I've since broken myself of the habit, and tend to avoid prefixes.
I've since broken myself of the habit, and tend to avoid prefixes.
I don't use any prefixes for anything. For global variables, I stick them in a "Global" namespace (and I avoid using namespace commands as much as possible). I don't really mind prefixes as much as I used to though, which is nice when it comes to conforming to an existing standard.
Question for people voting 'none': do you mean you ensure there is no conflict between members and locals, or do you really mean 'this-> (whenever necessary)'?
I don't know why but I have seen worse code with all member variables prefixed with ClassName::
Why the hell would anyone do this-> unless they had to?
Why the hell would anyone do this-> unless they had to?Because they wish they were writing in Python.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement