Well better get used to it if you decide to work on large projects. Because you will need to conform to whatever standards the project has in place and changes are that it is not going to be yours.
That is one reason why I don't really understand "Style Wars" because really you have to be flexible because everyone has their own style and projects are just going to redo all the code just so it can be understood better by one person. Locking yourself into one style is never a smart way to go in my opinion.
I don't mind switching styles at all. I'm just trying to be consistent in my own code, and I want other people who end up reading it to be impressed, or at least not hate the way it's written.
I guess I was just wondering what's the most common style used in good C++ production code.
Sorry that post wasn't really directed at you htirwin instead it was towards the "My style is better then your style" arguments I tend to see on forums from time to time.
But ya consistency is really all the matters (As long as you aren't doing stuff way outside of the box) to other people reading your code. Also being descriptive when naming I would say is a must also (Don't mean you have to write index instead of just i or little stuff like that, I'm more thinking along the lines of people writing something like "po" instead of "playerObject").
I totally understand what you mean. I also hate when people don't comment their code. I know someone might never see my source, but in case I decide to go back I document my code thoroughly.
Don't mean you have to write index instead of just i or little stuff like that, I'm more thinking along the lines of people writing something like "po" instead of "playerObject"
I hope I'm not taking that quotation out of context, but:
I agree with catfish here, actually, as it is still clear what it is. If there were multiple however, they would need different names to indicate why each of them is needed (e.g. originalpo, newpo, oldpo, etc).
Nope you got it backwards. in my opinion you should be descriptive with your naming. I don't want to have to scroll up or flip to the header file every 5 seconds to figure out what a variable is or what it is used for. Sure its easy to understand what po is when it is declared but what about a hundred lines later? 500?
@ Zereo: a modern IDE should help you with a hint regarding the type and whatnot.
Also like I said: I prefer using short names for trivial variables.
If the thing is still used 500 lines later then obviously it deserves a "full", descriptive name. The same applies in the case LB brought up: if there's more of 'em.
@ Zereo: a modern IDE should help you with a hint regarding the type and whatnot.
True, though I find it much easier to understand a project when the names actually describe the object. I like to be able to take a glance at something and instantly know what it is or at least have a idea of what it might be.
Whereas with short "initial names" as I like to call them you really can't tell what they are at a glance without being familiar with the project already (Even then you might have trouble). But you are right you can have the IDE give you hints to it.
Personally I don't mind working with either type of style but I do prefer when there is descriptive names for non trivial stuff and would be lying if I said I didn't wish everyone else felt the same ;p