473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What's your maximum line size preference?


Do you have a preference on maximum line width for C++ code?

I've seen the craziest debates on this most silly of topic.

I have witnessed engineers spent oodles of time fiddling with line
breaks just to get it right. I find in general a prescriptive rule
makes for markedly less readable code, which unfortunately is a
subjective argument, however, the waste of time modifying code when it
does not need to is not.

I'm interested in knowing what you'all do.

G
Oct 9 '08
53 12019
blargg wrote:
In article <12***************@irys.nyx.net>, yt******@nyx.nyx.net (Yannick
Tremblay) wrote:

[...]
>Don't get me wrong. The huge majority of my code is less than 80
chars. I do appreciate narrow simple lines. Just that I dislike a
hard rule that nothing should ever be wider than 80 chars because IMO
it is outdated and results in lower readability.

If the huge majority of your code's lines are less than 80 characters, how
could limiting those few other lines make a big impact on readability?
Because it would disregard that there's a reason that they're
that long despite the guideline.
[...]
Schobi
Oct 15 '08 #51
On Oct 15, 3:04*pm, blargg....@gishpuppy.com (blargg) wrote:
In article <1224061250.227...@irys.nyx.net>, ytrem...@nyx.nyx.net (Yannick
Tremblay) wrote:
[...]
Don't get me wrong. *The huge majority of my code is less
than 80 chars. *I do appreciate narrow simple lines. *Just
that I dislike a hard rule that nothing should ever be wider
than 80 chars because IMO it is outdated and results in
lower readability.
If the huge majority of your code's lines are less than 80
characters, how could limiting those few other lines make a
big impact on readability?
Having made a very strong statement in favor of a hard limit,
I'll now take the other side: there have been a few times when
I've been very tempted to violate the limit, sometimes by a lot.
The most frequent case is statically initialized tables: it
would be very nice (and much more readable) if I could make each
line in the table a line in the source code.

[...]
I prefer guidelines with judgement applied. *
I agree; guides, not hard rules (in most cases).
Rule 0 of any guidelines: any other rule in the guideline can be
violated with sufficient motivation. Typically, in a larger
organization, it will mean that you'll have to get it signed off
by your boss, or the architecture team, or someone in Q&A; in
more typical orgainizations, all it really means is that you'll
have to defend it in code review, and convince the reviewers.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Oct 15 '08 #52
On Wed, 15 Oct 2008 07:28:00 -0700 (PDT), Nick Keighley
<ni******************@hotmail.comwrote:
>and END-OF-FILE character?!
Obviously a Java programmer. They already had a one-class-per-file
rule years ago, irrespective of how trivial that class might be.

Obviously they've taken the idea further ;-)

Oct 15 '08 #53
Nick Keighley wrote:
On 15 Oct, 14:13, Michael <mich...@michaeldadmum.no-ip.orgwrote:
>Gianni Mariani wrote:
>>Do you have a preference on maximum line width for C++ code?

<snip>
>I will only insert an EOF character according to my own rule as follows:

1. After a semicolon
2. After the head part of conditional sentence (if, then, for, do,
while, switch, etc)
3. After {

and END-OF-FILE character?!
Sorry, it should be EOL (End-of-line).
Oct 16 '08 #54

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert | last post by:
dear sir: I have read the c++ primer plus 5 book, and do the chapter 12 programming exercises question 5, but the average_wait have negative result. I don't understand why? here is the code,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.