Forming code style standard guidelines

You newer know what might be liked

Moderators: overseer, arch, elder, avatar

Post Reply
User avatar
ilmarinen
Posts: 166
Joined: 21 Mar 2019, 22:32

Forming code style standard guidelines

Post by ilmarinen » 14 Jul 2019, 07:20

You know it has to be done, in some way.

First thing I suggest just to pick most freequent appearance of one or another style for lexical unit.

Or we can vote on using pre-defined by someone else code style, such as:
  • “gnu”: The default style for GNU projects
  • “k&r”: What Kernighan and Ritchie, the authors of C used in their book
  • “bsd”: What BSD developers use, aka “Allman style” after Eric Allman.
  • “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.
  • “stroustrup”: What Stroustrup, the author of C++ used in his book
  • “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel
  • “linux”: What the Linux developers use for kernel development
  • “python”: What Python developers use for extension modules
Examples of corresponding styles are shown in this Wiki article.

On the question of tabs vs spaces spaces (gladly :P) have won, among current developers and in retrospective.
On the question of two vs four spaces four scapes (sadly) have won.
User avatar
ilmarinen
Posts: 166
Joined: 21 Mar 2019, 22:32

Re: Forming code style standard guidelines

Post by ilmarinen » 14 Jul 2019, 07:21

Instead of using poll I suggest we just talk.
I really don't care which style you pick up, because my editor is so superior to yours it reformats code style for me :P
lujke
Posts: 8
Joined: 22 Mar 2019, 06:38

Re: Forming code style standard guidelines

Post by lujke » 14 Jul 2019, 09:36

My cards on the table: I don't know any of those code styles, and I'm a bit daunted by the prospect of having to learn something new. I understand it's a reaonable enough idea, but my RL involves a lot of academic pressure at the moment, so my coding is a release valve: I don't want it to start feeling like work...
User avatar
ilmarinen
Posts: 166
Joined: 21 Mar 2019, 22:32

Re: Forming code style standard guidelines

Post by ilmarinen » 14 Jul 2019, 15:44

Its not going to be enforced... Besides, we have 4 million lines of code, that just impossible.
Just pick what you like most, mewbe, so others can suffer from your decision, and you'll be left to lizardy thingies?
nienne
Posts: 8
Joined: 04 Apr 2019, 00:46

Re: Forming code style standard guidelines

Post by nienne » 15 Jul 2019, 01:32

I am quite happy with spaces, and four of them :P

I tend to have a standard pattern but I know it doesn't match some others (eg/ Saide/Ares use quite different bracket placement). I didn't really think much beyond my own standard feeding my OCD, as per Lujke I didn't really know there's all these different "ways" or whatever. I think mine is one of the java/c++ ones. k&r maybe? Given I learned java coding first in school, that's probably why.
ramius
Posts: 2
Joined: 21 Jun 2019, 00:59

Re: Forming code style standard guidelines

Post by ramius » 15 Jul 2019, 02:19

So I'm not a real coder, just someone who reads code and sorta translates it for others. My question is this: Is there a mass bash script we can run to standardize all code and put it in a format where standardization is easier (cause if this guy did it, I should do it too)?
User avatar
ilmarinen
Posts: 166
Joined: 21 Mar 2019, 22:32

Re: Forming code style standard guidelines

Post by ilmarinen » 15 Jul 2019, 19:47

ramius wrote:
15 Jul 2019, 02:19
So I'm not a real coder[...]
I can do it for tabs vs spaces issue at least... For the other stuff like

Code: Select all

if(blep) {
    mlem;
}
vs

Code: Select all

if(blep)
{
    mlem;
}
its not that trivial.
Post Reply