|
|
#1 (permalink) |
|
Dante’s Inferno
|
I would like to know some of your C++ Coding Preferences.
With: - Indentation -- Four Spaces - Bracket placement Code:
void shout()
{
cout << "HELLO!!!!!!!";
}
-- Yes: n + m; Yes: int n = 1; - Spaces between function name and starting parenthesis -- None: shout(); - Spaces between loop name and starting parenthesis -- One: if (n == 0) - Where the * goes in declaring a pointer (next to the type name or the variable name) -- Not sure for now, thats why I'm asking for your preferences but for now it's: int * n; - Where the & goes in declaring a reference (next to the type name or the variable name) -- Same as pointers: int & m = n; - Whether you omit the <int> in the following specialization: ( Code:
template <> void swap<int>(int &, int &) -- Yes Responses would be very helpful.
Last edited by naruto1327; 07-18-2006 at 11:55 PM. |
|
|
|
|
#2 (permalink) |
|
Ape for Diddy
Join Date: Jun 2006
Location: Detroit, MI
Posts: 255
Reputation: 14
|
I don't know much about C/C++, but this applies to all types of coding I do.
Indentation: Tab. Bracket Placement: For one-liners, I use int main() {, for anything more than one line: Code:
int main()
{
std::cout << "lol, C++\n";
cin.get();
}
Spaces between function name and starting parenthesis: No. Spaces between loop name and starting parenthesis: Yes. Spaces for references and pointers: No. Whether you omit the <int> in the following specialization: No clue what that is.
|
|
|
| Thread Tools | |
| Display Modes | |
|
|