|
Re: Programming style When to use Caps and Underscores?
I know the question was specifically about C18, but you can use whatever style you want. I think its worth picking a style that can cross multiple platforms, but its up to you. Over the last few years at work we've been moving towards a very simple set of standards that are easy to remember. I'm not a big fan of using prefix notation to add metadata to a variable name. We use c#, but this is a simple convention:
- everything is in CamelCase.
ex) robotSpeed, GetSensorValue(), DoWackyDance()
- private members scoped to a class begin with underscore and lower case.
ex) private int _speed;
- parameters begin with a lower case letter
ex) public int GetSensorValue(int sensorPort)
- property, method, class, and interface declarations start with upper case.
- locally scoped variables begin with an lower case letter.
- methods that return a value begin with a verb (i.e GetCredentials())
|