in my last PR (the [siginfo~] object), christof correctly pointed out a number of coding style inconsistencies and idioms that adhere to the C99 standard (rather than C89, which is what Pd is mostly using).

now i guess we all agree that it is a good thing to follow the same coding style throughout the codebase. now Pd already has a (distinct) coding style, but it's not formalized at all, and we basically rely on tacit knowledge of developers who know the codebase well.

this makes it super-easy for new contributors (and old ones, like me) to accidentally break the coding style.

it would be great if we had a document (CONTRIBUTING.md, or in the HTML-docs) that would spell out the expectations. (there's already src/CHANGELOG.txt, but it's *very* rudimentary; basically it only says that you should use 4 spaces of indentation, instead of tabs; and it does so in the *changelog* under the "original source note* heading (which comes after the changes for Pd-0.37...).


since the knowledge is only tacit, i cannot even name all the rules.
at least there is:
- indentation is 4 spaces (no tabs)
- no trailing whitespace (EOL, EOF)
- comments get an extra 4-space indentation
- space after "for", "if", and the like
- space around assignment ("=") and comparators ("==")
- pointer declarations with variables ("t_symbol *s" rather than "t_symbol* s")
- Allman brace style
- ...


somewhat related (I think), is the question of which C standard we want to adhere to. traditionally Pd is C89, but some C99 features have crept in over the last years. could we agree on C99 as the baseline standard, or at least the subset of C99 that is even supported by iffy compilers like MSVC15?




i've started two discussions on github:
- Coding Style: <https://github.com/pure-data/pure-data/discussions/2933>
- C standard: <https://github.com/pure-data/pure-data/discussions/2934>

but I guess some people might feel more at home with discussing this here...

cheers and happy patching,
gmdasr
IOhannes

--
please do not CC me for list-emails

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

 ---
[email protected] - the Pd developers' mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/K5LAU3GT4OXOZK52DR33PQZUIS277WZZ/

Reply via email to