Deutsch English Français Italiano |
<vpni33$2ld5k$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.c Subject: Re: Which code style do you prefer the most? Date: Wed, 26 Feb 2025 18:13:05 +0100 Organization: A noiseless patient Spider Lines: 44 Message-ID: <vpni33$2ld5k$1@dont-email.me> References: <vpkmq0$21php$1@dont-email.me> <vpl62m$250af$1@dont-email.me> <87frk10w51.fsf@onesoftnet.eu.org> <vpn8vs$2jmv1$1@dont-email.me> <vpn92i$86q$1@reader1.panix.com> <vpnfmn$2ksdj$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 26 Feb 2025 18:13:07 +0100 (CET) Injection-Info: dont-email.me; posting-host="f15dbda4db70a6f9b37f9a6418442d56"; logging-data="2798772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19++G++E7ha83ds7TBxIfjK" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:amJ3/5d97JtGEEVVEi+CEyNvjug= In-Reply-To: <vpnfmn$2ksdj$1@dont-email.me> X-Enigmail-Draft-Status: N1110 Bytes: 3208 On 26.02.2025 17:32, David Brown wrote: > On 26/02/2025 15:39, Bradley K. Sherman wrote: >> Just do your best to keep it neat and under 80 columns. >> > > Neat, yes. 80 columns, no - unless you are living in the previous century. That's the typical response of someone who obviously doesn't care. :-/ > > Lines that are too long are hard to read, but the idea that 80 columns > is a good number or should be a hard limit is /long/ outdated. About > 100 - 120 columns is a better fit for a lot of code, letting you use > sensible identifiers without excessively splitting logical lines into > multiple physical lines. This sounds more reasonable. :-) But it depends. - Whether 80, 120, 180, or 240 are the holy grail? From own experience a few observations... In Java projects I've seen prevalently extreme long identifiers, which result in extreme long lines; often hardly readable. From typesetting we know that long lines are bad to read; why are the newspaper columns so narrow? Long lines are even worse to read if you use sans-serif fonts; too bad that such bad fonts are dominating our modern world, and especially in the IT ("thanks" MS for fostering Arial, etc.); using less columns is also often advantageous here to compensate the reduced legibility. Don't expect that everyone has a screen as big as yours; that is the case in companies but also in other places or projects where code is shared or where people work together. Myself I have the habit to take an 80 column screen as baseline, organize my source code in that frame. But that's no credo; the purpose is just to not let the lines get too long "by accident". I then wrap the code at sensible places with indentation. And if _some_ lines get longer, say your 100 or 120 columns, that's no problem as long as the overall readability is still guaranteed. Again, preferences vary, here as well. Janis