Looking through Visual Assist's options I found that it can draw a horizontal line at a given column, by default column 75, to suggest when you should move to a new line.
I've never really worried about the length of the lines of my code, other than going to a newline when I approach the edge of my screen. At both studios I have worked at, we all used the same monitors, and maybe that's why it never came up. I don't remember it being mentioned in the coding standards.
I would feel really cramped at 75 characters per line. Does anyone actually follow such guidelines?
Do you limit the length of code lines?
- johnhpus
- Platinum Sponsor

- Posts: 1186
- Joined: Sat Apr 17, 2004 2:49 am
- x 3
- steven
- Gnoll
- Posts: 657
- Joined: Mon Feb 28, 2005 1:53 pm
- Location: Australia - Canberra (ex - Switzerland - Geneva)
- Contact:
I try to limit to 75 or 80 characters for two reasons:
- With two VC open simultaneously side-by-side each taking half my wide-screen with 80 characters I don't need to scroll horizontally
- When printing code I like to do it with double columns in landscape format with Ultraedit. This permits the code formatting to stay nice (no ugly line breaks).
- With two VC open simultaneously side-by-side each taking half my wide-screen with 80 characters I don't need to scroll horizontally
- When printing code I like to do it with double columns in landscape format with Ultraedit. This permits the code formatting to stay nice (no ugly line breaks).
- xavier
- OGRE Retired Moderator

- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
I never did until my current position, when one of the engineers on the team asked me if I did that. At the time I said no, I've never heard of that, but then it dawned on me that this comment line in code (such as Ogre)
was more than just decoration or function separator -- it served as a marker for line length. Since then I've been using it consistently (although not always limiting to the 78-characters of that line). 
Code: Select all
//----------------------------------------------------------------------------
- Kojack
- OGRE Moderator

- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 538
One of the places I worked at had a line length limit in the coding standard doc. Every file was printed out for multiple peer reviews, so we had a strict 78 character limit to fit on an a4 page without wraparound causing confusion.
The coding standard also specified where whitespace could be used, capitalisation, function names, etc.
It was annoying at first, but we had virtually zero integration issues when code from multiple programmers came together.
After that I still tend to follow a line limit, but I don't print code so I usually work to whatever fits in VC. Most of my coding is done in a full width source window on a 1280x1024 screen (the other panels like output, solution browser and stuff are on the second monitor), so I can get 153 characters per line without horizontal scrolling. But I generally don't go above 130.
The coding standard also specified where whitespace could be used, capitalisation, function names, etc.
It was annoying at first, but we had virtually zero integration issues when code from multiple programmers came together.
After that I still tend to follow a line limit, but I don't print code so I usually work to whatever fits in VC. Most of my coding is done in a full width source window on a 1280x1024 screen (the other panels like output, solution browser and stuff are on the second monitor), so I can get 153 characters per line without horizontal scrolling. But I generally don't go above 130.
- SunSailor
- Gnoll
- Posts: 699
- Joined: Sun Jan 02, 2005 5:45 pm
- Location: Velbert, Germany
- x 2
- Contact:
On my side, it really depends. On our linux components, I'm working with the vi and as it doesn't handle wraps very nice (only line wrapping, no scrolling), I tend to keep the code within the screen limits where possible. Rather short function names used in our linux components (They are command line only) are benefiting this. On the other hand, under windows the length of a lot of functions, especially from the windows API, are resulting in the fact, that a line can reach easily 100 and more characters per line - especially, as there sometimes to often isn't any suitable solution to wrap the code AND keep it readable.
- Klaim
- Old One
- Posts: 2565
- Joined: Sun Sep 11, 2005 1:04 am
- Location: Paris, France
- x 56
- Contact:
- johnhpus
- Platinum Sponsor

- Posts: 1186
- Joined: Sat Apr 17, 2004 2:49 am
- x 3
Thanks for the perspectives.
Reddit must be reading my mind, as there is an article on this topic linked from there today: http://richarddingwall.name/2008/05/31/ ... -relevant/
Reddit must be reading my mind, as there is an article on this topic linked from there today: http://richarddingwall.name/2008/05/31/ ... -relevant/
- nullsquared
- Old One
- Posts: 3245
- Joined: Tue Apr 24, 2007 8:23 pm
- Location: NY, NY, USA
- x 11
Code: Select all
reallyBigObject.reallyBigFunction(
someOtherReallyBigObject.doThisAndThatAndThoseToo(
blah, foo, bar, foobar, barfoo, etc, profit),
etcStuffThatNeedsToBe,
passedtoTheReallyBigObject);
Besides, indenting really helps with reading which parameters go where, sort of how block indentation works.
- Game_Ender
- Ogre Magi
- Posts: 1269
- Joined: Wed May 25, 2005 2:31 am
- Location: Rockville, MD, USA
I use a 80/79 character limit. Its because I hate horizontal scrolling and like the ability to have multiple code windows up one monitor at once. I have noticed many windows programmers are lazy with there line widths. I frankly look at as sloppiness
, but I shouldn't be one to talk because I can be less consistent with other formatting issues myself.
Robotics @ Maryland AUV Team - Software Lead
