Changes

Jump to: navigation, search

Team Excellence - oop344 20113 Code Standards

140 bytes added, 23:15, 13 October 2011
no edit summary
{{OOP344 Index | 20113}}
=Code Standards=
Fardad suggested in class today that we make a document that defines the format that our code is presented in so I've made this page to outline them.
 The sections that follow are just ones that I could think of. If you know of other things feel free to add them==If Statement==
<syntaxhighlight lang="cpp">
if (condition){
If the "stuff" is only one line the curly braces can be omitted.
==For Loop==
<syntaxhighlight lang="cpp">
for (i=0; condition; i++){
Similar deal as with the if statement if "stuff" is only one like the curly braces can be omitted.
==While Loop==
<syntaxhighlight lang="cpp">
while (true){
Also the curly braces can be omitted if "stuff" is only one line.
==Function Declarations==
<syntaxhighlight lang="cpp">
void foo(int a){
Also there's no space between the ')' and '{'.
==Indents==
I think each indent should be the equivalent of two spaces. You can change the settings of Visual Studio to put in 2 spaces whenever you press tab. This will keep the code properly aligned and if someone isn't used to using tab for indent they can easily just use two spaces.
==Class Member Variables==
I think we should follow Fardad's lead and start all of our class' member variable names with an underscore '_' to differentiate them from other variables.
= Comments =
1
edit

Navigation menu