-
Notifications
You must be signed in to change notification settings - Fork 0
style guide
Perry teaches the following concerning commenting.
- Do it. Comments allow you and others to get back into the zone faster.
- Comment your thinking not what you're doing. Anyone reading the code knows what i++ means. Don't comment "increment i"
- The bulk of your comments should come before the function where you describe the purpose of the entire function - what are your expectations for it? Any assumptions? What side effects does it have? Break out exceptions that leave the function separately as they are side effects.
- Use this template:
/* FUNCTIONNAME() - This function Parameters: Returns: Side Effects: Expceptions: */
Whenever you have something serious to bring our attention to use:
// NOTE: // NOTE: The comment // NOTE:
The prefix and suffix are necessary.
If it at all matters, do it!
Should be kept to one. At the bottom.
Tab stops set at 4. No Exceptions
Whoever adds to a source file must adhere to the bracing style already present in that file.
The preferred style is the brace-on-newline style:
if (bool)
{
}
else
{
}
while (bool)
{
}
type NameOfFunction(type arg1, type * arg2, type & arg3)
Nothing extraordinary here.
Functions begin with caps. Variables don't.
Functions are camel back. No exceptions.
Variables should be words_split_with_underscores. However, if you're the first author of a file you can choose a different style. Second or later contributors must follow the variable naming style found in the file.
Constants ought to be ALL CAPS but not always. If they are shared between functions or methods, they should be ALL CAPS.
Use descriptive variable and function names. Typing is finite. Debugging is not.
pas is Copyright © 2017 by Perry Kivolowitz - see license