Deutsch English Français Italiano |
<vpkr2l$22c6h$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: Which code style do you prefer the most? Date: Tue, 25 Feb 2025 17:28:05 +0100 Organization: A noiseless patient Spider Lines: 38 Message-ID: <vpkr2l$22c6h$2@dont-email.me> References: <vpkmq0$21php$1@dont-email.me> <XnsB29169B4B7798hueydlltampabayrrcom@135.181.20.170> <vpknua$21ti1$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 25 Feb 2025 17:28:05 +0100 (CET) Injection-Info: dont-email.me; posting-host="bcf078c29dd0a88de04e57d1ac346cf1"; logging-data="2175185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187UloHCpNWeTqVlCBSiibYtopubzPs9xc=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:juPhZtpR0Em+j82GnuhrUdjDSg4= Content-Language: en-GB In-Reply-To: <vpknua$21ti1$1@dont-email.me> Bytes: 2753 On 25/02/2025 16:34, Ar Rakin wrote: > On 2/25/25 9:23 PM, David LaRue wrote: >> I used a style similar to this in school. Before that I used much the >> same. >> As for existing code bases I prefer to keep their style and add comments >> accordingly. That generally goes for any language. > > Agreed. For existing projects, the code style should be preserved. Yes - within reason. It is not good to be obsessive about coding style - even within existing projects with lots of contributors, there can sometimes be good reasons for wavering from a common style. And for your own code, don't be afraid to find a better way of writing your code. You don't have to be restricted to a C standard that was replaced a generation ago. You don't have to limit yourself to code that was designed to work well with computers, software and screens from four decades ago. If you feel that the GNU or Linux coding styles work well for the code you want to write, fair enough. But don't use them simply because GNU or Linux uses them - unless you are contributing to GNU or Linux projects. > >> Popularity of a style shouldn't be a goal. It should be consistantly >> readable and documented. We must write for ourselves as well as our >> future >> self and others. > > This is true. I just wanted to know which style most people seem to prefer. > There is no one style that has anything like a majority position, especially not when you consider all the possible variations. And even if there was, picking a style due to popularity is as sane as picking a religion based on popularity.