Coding Standards

From JUCE

Jump to: navigation, search

The coding style in JUCE is pretty strict and consistent, but it's a style that evolved gradually, and I've never tried to actually write down a set of "rules" before.

But recently chatting with someone who'd made a few code contributions, they commented that no matter how much they tried to make their code look like mine, I always seemed to completely re-write it before accepting it! So as an experiment, I've tried to come up with a set of rules that, if followed, should go some way towards producing code that resembles the JUCE codebase.

Some of this stuff is basic C++ good practice. Some of it's JUCE-specific. Most of it's just my personal preference! I'm certainly not claiming this to be a definitive set of rules by which you should live, and I'm not particularly interested in arguing or defending any of the points here - it's just a description of what I ended up doing after many years of coding. YMMV!

Contents

Basic layout and whitespace

Naming conventions

Types, const-correctness, etc

Object lifetime and ownership

Classes

class Thing   : public Foo,
                public Bar
{

Miscellaneous


I'm sure this list is nowhere near complete, (and probably never could be), but I'll keep adding to it when things occur to me...

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox