:: Re: [DNG] C source style [was vdev …
Inizio della pagina
Delete this message
Reply to this message
Autore: Didier Kryn
Data:  
To: dng
Oggetto: Re: [DNG] C source style [was vdev status update in daedalus]
Le 30/07/2025 à 20:53, Wm. Moss via Dng a écrit :
> On 30/07/2025 14:02, aitor wrote:
>>
>> Hi,
>>
>> On 30/7/25 11:36, Didier Kryn wrote:
>>> Therefore, IIUC, they assume inconsistencies in the position of the
>>> openning brace with respect to line-break and indentation.
>>
>> Not only Linux, but also FreeBSD, Xorg and Wayland
>>
>> Personally, I find this exception reasonable because functions with a
>> long argument list often require to be broken into smaller chunks:
>>
>> structevent_source *
>> event_loop_add_signal(structevent_loop *loop,
>> intsignal_number,
>> wl_event_loop_signal_func_tfunc,
>> void*data)
>> {
>> body of the function
>> }
>>
>>> Their problem... with all due respect for their great work.
>>
>> Linus Torvalds was less polite (the document seems to be written in
>> 2016):
>>
>> "First off, I'd suggest printing out a copy of the GNU coding
>> standards, and NOT read it. Burn them, it's a great symbolic gesture."
>>
>> Cheers,
>>
>> Aitor.
>>
>>
>>
>> _______________________________________________
>> Dng mailing list
>> Dng@???
>> Manage your subscription:
>> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>> Archive: https://lists.dyne.org/lurker/list/dng.en.html
>
> AT&T Bell Labs had a recommended programming standard. The start meta
> character was placed under the logical expression or function. That
> is, the code block started on its own line and in the leftmost column.
> Other recommendation were for an indent of 3 or 4 (we all used 4, half
> a tab) and a file heading that could be processed by troff.
>
> Code was very legible; a requirement when the complexity is very high.
> Since we performed regular peer reviews, spaghetti code was minimized
> no matter the coding language.
>
> Regretfully. the psychology of interpreted BASIC and the self taught
> programmer has won out.
>
> I still have my Bell Labs Programmers Work Bench manuals and the
> coding standards. While rather out of date, C Programming Guidelines
> by Thomas Plum is a worthwhile read.
>

    Likewise, I prefer putting *all* openning curly braces on their own
line, and similarly the closing curly braces. I mean when the curly
braces enclose instructions; the style is more flexible for array
initializers.

    Like everybody I use 4 characters for C, but 2 characters for HTML
and SVG.

    My preference goes to clarity and readability by all means, even if
it, sometimes, leads to violating the general style. One should remember
that the source is written, reviewed and modified by bare humans, and
much more often read than written, so that it deserves spending efforts
to write it in this spirit.

    Torwalds is well known to be very agressive against the opinions
differing from his own (~:

--     Didier