Jump to content
  • Advertisement
Sign in to follow this  
Tradone

Indentation Style which is best?

This topic is 4474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

which indentation style do you feel is the best? and can you recommend me the best C++ text editor?

Share this post


Link to post
Share on other sites
Advertisement
The best is which ever YOU like most.

As far as text editors, I prefer the Visual Studio (Visual C++) editor. You can get the Express version of Visual Studio 2005 for free. For me it's the best, but it may not be for others. Best is relative.


-SirKnight

Share this post


Link to post
Share on other sites
Personally, I like the 2 space style.

For example:

void main()
{
cout << "I like this indentation style!" << endl;

if (true)
{
cout << "See? It's nice." << endl;
}
}



This method let's me keep track of whether my brace brackets are lined up properly, and are complete.

As for editors, there are quite a few available. Check out the Forum FAQ

Share this post


Link to post
Share on other sites
Tabs until indent level, spaces for mid-line alignment. That way, any other people who have different tab sizes will see it how they want to see it and won't have mid-line spacing problems.

Share this post


Link to post
Share on other sites
Personally, I use BSD/Allman style indentation with 4 space wide hard tabs. And since this will probably come up sooner or later, I use .NET's naming conventions in all languages that I code in.

As for editor, I stick to VS. The vim and emacs people can go on all they like, but I don't buy any of it (and I'm familiar and comfortable with both editors). Simple and direct works fine.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nypyren
Tabs until indent level, spaces for mid-line alignment. That way, any other people who have different tab sizes will see it how they want to see it and won't have mid-line spacing problems.


I've never understood why the majority of people don't seem to do that.

Share this post


Link to post
Share on other sites
Quote:
Original post by Roboguy
Quote:
Original post by Nypyren
Tabs until indent level, spaces for mid-line alignment. That way, any other people who have different tab sizes will see it how they want to see it and won't have mid-line spacing problems.


I've never understood why the majority of people don't seem to do that.


Can you show me an example?

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Personally, I use BSD/Allman style indentation with 4 space wide hard tabs. And since this will probably come up sooner or later, I use .NET's naming conventions in all languages that I code in.


Yes, that's the indent style I use, except I prefer 2 space tabs. My naming conventions are pretty much a mixture of various other conventions. I do, however, seem to favor the java naming conventions for functions.

Example: void removeObject(...);

That's only because I find it more visually appealing, though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tradone
Quote:
Original post by Roboguy
Quote:
Original post by Nypyren
Tabs until indent level, spaces for mid-line alignment. That way, any other people who have different tab sizes will see it how they want to see it and won't have mid-line spacing problems.


I've never understood why the majority of people don't seem to do that.


Can you show me an example?



int main() {
int array = {1,
2,
3,
4};
if (/*...*/) {
// ...
}
}


Note which spaces are tabs and which aren't. It will all be lined up regardless of the tab size used.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!