Deutsch English Français Italiano |
<87frk10w51.fsf@onesoftnet.eu.org> 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: Ar Rakin <rakinar2@onesoftnet.eu.org> Newsgroups: comp.lang.c Subject: Re: Which code style do you prefer the most? Date: Wed, 26 Feb 2025 17:43:06 +0600 Organization: A noiseless patient Spider Lines: 38 Message-ID: <87frk10w51.fsf@onesoftnet.eu.org> References: <vpkmq0$21php$1@dont-email.me> <XnsB29169B4B7798hueydlltampabayrrcom@135.181.20.170> <vpknua$21ti1$1@dont-email.me> <vpkr2l$22c6h$2@dont-email.me> <vpksh4$22p3p$2@dont-email.me> <vpl62m$250af$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 26 Feb 2025 12:43:07 +0100 (CET) Injection-Info: dont-email.me; posting-host="3819d60e36b63f24b1100dea27559741"; logging-data="2675633"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18y2FDFo5VF0D1k/c2ydTdDHp18MqRPufc=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:LJYqGNqEtAjQz/0dCXD04rXiIPY= sha1:4BXrOKnZG8VzC8ISLHog1Ag169c= Bytes: 3113 David Brown <david.brown@hesbynett.no> writes: > On 25/02/2025 17:52, Ar Rakin wrote: >> On 2/25/25 10:28 PM, David Brown wrote: >>> >>> 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. >> I agree! The C projects that I have built use latest C features. I >> usually always use the `-std=gnu17` or `-std=gnu23` compiler >> flag. (Yes, I do use the GNU C extensions often.) > > In that case, use // comments instead of /* */ comments when it makes > sense. Use line layout that makes sense and suits /your/ usage - > don't use a layout for function definitions based on what some ancient > editor liked unless you also like that ancient editor, or you like > that layout. Pick a tab size that suits /your/ preferences for > coding, using tab characters or spaces for whatever works best with > /your/ choice of tools. I actually prefer /* */ comments over // comments. There is no specific reason for this, I just tend to like it that way. And yeah, I use Emacs, you *might* say it is ancient but I love Emacs. > It's fine to have different preferences - and some layouts are better > than others for certain types of code, or when working with particular > tools. The type of code you are working on can affect how well a > particular style suits the code. > > So don't try to look for some kind of perfect "universal" style. All > you can be sure of is that whatever style you use, the next person > that looks at your code will think it's uglier or more error-prone > than their preferred style. That applies even if the "next person" is > yourself in a few years time. This is true!