← Back to team overview

kicad-developers team mailing list archive

Re: Code Style (Re: Graphics Abstraction Layer)


Torsten Hüter wrote:
Hi Dick,

Style is important to Wayne and me, and I assume Jean-Pierre, and we will be releasing a coding style document *very* soon.

Style is very important to me too - we had during my studies and in our company enough discussion about this point. Currently we found the compromise, the typical JAVA-style.

My question is, because the KiCad style looks a bit unusual to me and it's not consistent. I'd like to know if there was a voting or if this was a personal preference.

The project is not a democracy. It is "closer to" a group of share holders at a stock holder's meeting. I say it is "closer to", and not exactly like, and this is accurate. Where it can deviate is when somebody just gets louder on a particular issue and the larger shareholders can back off a little. Jean-Pierre is the largest shareholder.

I don't make noise on it everyday, but I keep most of my powder dry for the style discussion. I chose the style, picked uncrustify & chose the uncrustify.cfg settings and beautified scores of source files. It would be impossible for anyone to be louder on this subject.

The code style should be clean, logic and commonly used in my opinion. However, I have no big problem to adapt myself to the KiCad code style (like I've done for the patches).

Notice that our classes are all uppercase, at least the new ones.

Perhaps you could elaborate on this topic - I see the problem that a class written all uppercase could be confused with a constant and you need an underscore which I don't like.

I like this:





However, I've learned Java at the university, this explains perhaps my choice.


QT seems to use this style too.

This just shows what someone else likes, not what I like, and where we are trying to go in this project. After 29 years of writing C, C++ and Java (40+ hours per week), it is even remotely possible that I don't know what I like? (I once wrote a project like wxwidgets all by myself, a knock off of CommonView for OS2, so I do not stand in amazement at the style choices made by the Qt team.)

For other projects like the linux kernel, I do conform to the established style they set, because I am not a large share holder in the linux kernel. But I do not like their style, neither the brackets nor the tabs. I was early enough in this Kicad project to become a large shareholder and to set the style when there was essentially none, and this should not be meant to slight all the fine work from Jean-Pierre. A project this big, simply needed help.

As code beautifier I'm used to Eclipse CDT's build in variant, but I'll have a look at uncrustify.

Thanks, it is more about the uncrustify.cfg settings. The easiest way, but not the only way, is to use uncrustify to at least learn the desired style.

Wayne has prepared a coding style document and I am reviewing it now. Wayne is a *great* contributor to this project and he has my considerable respect.

The biggest thing we'll have to button down on is to not use tabs, but rather spaces. Spaces are the standard here.

Thanks again for your efforts, and we are respectful of your purported talents also. You have been given a green light to contribute in abundance. I thank you and the project thanks you.


(Your university education is a great start! Don't let it hold you back though, keep reading, and you'll learn far more in your career than you could have ever dreamed at the university.)

Follow ups