Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalise whitespace in all C code #34

Open
pippijn opened this issue Jul 29, 2013 · 5 comments
Open

Normalise whitespace in all C code #34

pippijn opened this issue Jul 29, 2013 · 5 comments
Labels

Comments

@pippijn
Copy link
Collaborator

pippijn commented Jul 29, 2013

In general, tabs are used for both indentation and alignment, but sometimes spaces are used for indentation, sometimes a mixture is used. We should normalise this to something. I would suggest tabs for indentation and spaces for alignment, so it looks good with any tab-width setting.

@pippijn
Copy link
Collaborator Author

pippijn commented Jul 29, 2013

Actually, I just checked, and that would change a lot of code. We should stay close to the original indentation, which assumes tab = 8 spaces, indents with tab and aligns with a mixture of both (tabs first, then spaces).

@pippijn
Copy link
Collaborator Author

pippijn commented Jul 29, 2013

There are other inconsistencies in formatting. We should prepare a document with coding style hints.

@edi-meier
Copy link

Just for fun I tried "indent -gnu, -linux, -kr, -orig". ccode.c does seem to resemble to any of them.
Maybe choose a common, i.e., well known coding style, whichever it might be.

@pippijn
Copy link
Collaborator Author

pippijn commented Jul 31, 2013

I have started a document on coding style and formatting/indentation guidelines in the wiki. These are gradually assembled from findings in the aldor source code. I am trying to create a well-founded set of guidelines in which people can find an answer to every question. Eventually, I will also want to enforce some of these guidelines (especially naming conventions). It's a lot of work to write all these things down, so if someone finds more guidelines, feel free to edit the wiki.

Also, I welcome feedback on the current guidelines, as well as ideas for additional guidelines that the current codebase does not follow. (E.g. the header inclusion order guideline is not followed anywhere, yet.)

@pbroadbery
Copy link
Member

On Thu, Aug 1, 2013 at 12:59 AM, Pippijn van Steenhoven <
[email protected]> wrote:

I have started a document on coding style and formatting/indentation
guidelines in the wikihttps://github.com/pippijn/aldor/wiki/Coding-style.
These are gradually assembled from findings in the aldor source code. I am
trying to create a well-founded set of guidelines in which people can find
an answer to every question. Eventually, I will also want to enforce some
of these guidelines (especially naming conventions). It's a lot of work to
write all these things down, so if someone finds more guidelines, feel free
to edit the wiki.

Also, I welcome feedback on the current guidelines, as well as ideas for
additional guidelines that the current codebase does not follow. (E.g. the
header inclusion order guideline is not followed anywhere, yet.)

It's probably worth mentioning that the emacs 'linux' coding style is
pretty close to these guidelines - it's what I've been using (it might
differ on switch statements, but I can't get excited about precise matching
in that case).

There probably ought to be a note that '#if's should only exist in a very
small number of files.. cconfig.h, compopt.h and platform.h. Use of
editlevels.h #defines is wrong; if one is in doubt about a change, add a
unit test (checking that nothing else breaks) and be extra verbose in the
commit message.

Last aside - assert should be used more enthusiastically throughout..

Peter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants