Deutsch English Français Italiano |
<vpl62m$250af$1@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 20:35:50 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: <vpl62m$250af$1@dont-email.me> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 25 Feb 2025 20:35:51 +0100 (CET) Injection-Info: dont-email.me; posting-host="bcf078c29dd0a88de04e57d1ac346cf1"; logging-data="2261327"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5R6vhab5X05nnSA45HRpqZn3/Dvf9jIc=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:BkynsjH7iCxNMWiRqkRXkMnWYJM= In-Reply-To: <vpksh4$22p3p$2@dont-email.me> Content-Language: en-GB Bytes: 2796 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. 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.