KDevelop5/CodingStyle: Difference between revisions

    From KDE TechBase
    No edit summary
    No edit summary
    Line 29: Line 29:
    }
    }
    </syntaxhighlight>
    </syntaxhighlight>
    == Using Namespaces ==
    Never add a "using namespace ..." to a header. Do use that though in every .cpp file , esp. for the KDevelop namespace.

    Revision as of 22:00, 11 November 2012

    The current KDevelop code base is very inconsistent when it comes to the coding style. So please adhere to the file's coding style you are working on / patching.

    For new files / projects / plugins, please use the Policies/Kdelibs_Coding_Style guidelines. Here are a few special additions:

    Class Initialization

    // wrong foo.h
    class Foo : public Bar {
    public:
      Foo(int i, int j) : Bar(i), bla(j) {}
    private:
      int bla;
    };
    
    // correct foo.h
    class Foo: public Bar
    {
    public:
      Foo(int i, int j);
    private:
      int m_bla;
    };
    // foo.cpp
    Foo::Foo(int i, int j)
    : Bar(i)
    , m_bla(j)
    {
    }
    

    Using Namespaces

    Never add a "using namespace ..." to a header. Do use that though in every .cpp file , esp. for the KDevelop namespace.