What is your coding style? - Programming On Unix

Users browsing this thread: 2 Guest(s)
seninha
Long time nixers
(25-05-2021, 02:49 PM)ckester Wrote: In turn my astylerc enforces rules loosely based on the NetBSD style guidelines, but is still evolving:
That's the first time I heard about astyle, thanks for pointing it out. I know about indent(1), that does the same job. However, astyle seems to be more full-featured than BSD indent(1). There's also GNU indent(1), but I do not trust it, as it has the awful GNU coding style as default.

NetBSD also has a indentrc in its source tree.
OpenBSD does not have a standard indentrc, but I will steal the one from this reddit post.

I never used indent(1) nor astyle(1). I will try the first (which is already available in all BSDs), mapping it to gq in vim (a keybinding I use to format prose, but that has no use in code). If I find that it does not fit my style I'll try astyle then.

(25-05-2021, 02:49 PM)ckester Wrote: I occasionally lapse into CamelCase
That's actually PascalCase, camelCase has the first letter in lowercase.


(25-05-2021, 01:34 PM)opfez Wrote: When I'm writing C, it's a combination of kernel style (which Emacs is configured to) in addition to putting return values on separate lines.
Emacs defaults to GNU coding style! Run away from it!

(25-05-2021, 01:34 PM)opfez Wrote: I don't think there are distinct styles in Lisp, but I put long arguments on separate lines, with the first one sharing the line of the function name, like so:

Code:
(cond ((some-long-predicate-foo a) 3)
      ((another-long-bar b) 4)
      (else 6))

It makes it nice and readable, and fits well with the semantic understanding of Lisp as a tree.

I'm reading SICP. It's the first time I touch LISP, so I'm just using its style for scheme (the same way as I copied K&R style the first time I touched C, while reading K&R).


Messages In This Thread
What is your coding style? - by seninha - 25-05-2021, 11:43 AM
RE: What is your coding style? - by venam - 25-05-2021, 12:47 PM
RE: What is your coding style? - by opfez - 25-05-2021, 01:34 PM
RE: What is your coding style? - by jkl - 25-05-2021, 01:41 PM
RE: What is your coding style? - by ckester - 25-05-2021, 02:49 PM
RE: What is your coding style? - by seninha - 25-05-2021, 09:58 PM
RE: What is your coding style? - by s0kx - 26-05-2021, 02:34 AM
RE: What is your coding style? - by venam - 26-05-2021, 09:40 AM
RE: What is your coding style? - by jkl - 26-05-2021, 09:55 AM
RE: What is your coding style? - by opfez - 27-05-2021, 08:27 AM