Coder Social home page Coder Social logo

majerle / c-code-style Goto Github PK

View Code? Open in Web Editor NEW
1.0K 54.0 231.0 156 KB

Recommended C code style and coding rules for standard C99 or later

Home Page: http://majerle.eu

License: MIT License

C 33.28% Python 66.72%
c style coding rules c-rules c-code-style

c-code-style's Issues

General Thoughts

Hey! I think this is a great style guide and as I'm reading through it I'm going "yep, yep, yep" as I agree with nearly all of it. I intend to adopt a few of these too like the prv_ idea. A few things though:

  • What is wrong with first curly bracket on the next line?

  • Not initialising variables to 0? In places I've worked, uninitialised variables will fail your peer review.

  • Declaring all variables at the top of a block is a bit old fashioned.

  • I think it's nicer to underscore de-limit function names and camel-case variables. void my_func(void); int32_t myVar = 0;

  • I agree strongly with documenting #if/#elif/#else/#endif statements. Oh my god this helps so much!

cfg AStyle formatter does not fix all the conventions

I tried using the astyle-code-format.cfg file with style but it almost only fixes indents and braces. I like the rules you described for variable and function naming but I couldn't find a way to format my C files according to that. There is no such option in AStyle. So even if I use your cfg file with AStyle, there is no difference between using yours or a predefined XML file on Eclipse (like original K&R etc.)

License Please

Problem Description

This project has no LICENSE file at its root.

Technically I believe this makes it your intellectual property, and others that find it shouldn't assume you're willing to share it... I'm no lawyer, but if this were a software project, it wouldn't be OSS without a license.

Assumption : Intended to be open (?)

I'm assuming you're happy for people to share and use this for their own projects openly... either way, if your intent for this standard is:

  • open: an open license is necessary for people to use it legally
  • closed: a license stating that you'd like to be contacted before it's copied would also be helpful to those that find it.

Document mistake

Functions:
-> When function returns pointer, asterisk character must be aligned to return type (char*), example for "ok" and "wrong" is the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.