Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi Christina,

On 2011-05-03 at 20:35 +0200, Chr. Rossmanith wrote:

static void <prefix>ShapePropertiesFromDFF (const SvxMSDffHandle* pData, 
com::sun::star::beans::PropertyValues& rPropValues)

with <prefix>  = "lcl_" or "[Ii]mpl" - is one of these prefices more 
modern than the others? What about indentation and formatting of 
if/then/else or switch statements? Any rules?
Though that's a matter of taste ... ;)
That's why I've asked for review  :-)

We do not have strict coding rules (even though I personally would like
to have something more 'official', the discussions about them tend to
create huge, and unproductive flame wars we do not want to start), but
the following is common to all the styles seen in the LibreOffice code:

- four spaces for indentation instead the tab characters
  (vi: set shiftwidth=4 softtabstop=4 expandtab)
- '{'s (beginnings of blocks) on new lines, newlines after '}'s
- spaces after ','
- spaces around '='
- blocks begin at the level of the keyword (if / for / switch),
  indentation inside the block

Eg.
static int IDontKnow( int something )
{
    static int i = 0;
    if ( i < something )
    // or if (i < something)
    {
        ++i;
        return something;
    }
    return 42;
}

In most cases there are

- spaces after keywords

Sometimes yes, sometimes no:

- spaces after '(', and before ')'

Controversial bits are:

- in most of the codebase, variables are named like xName [where x is
  'p' for pointers, 'r' for references, 'n' for integer types, 'e' for
  enums, 'a' for other types]
  - this is controversial because eg. for an obvious iterator in 'for',
    it makes no sense to name it aIterator; 'i', or 'it' usually works
    well
- attributes are prefixed with m_ doing m_xName
- methods use CapitalFirstThenCamelCase(), or
  firstSmallThenCamelCase(), static functions
  impl_TheFunction()
  - or at least my memory says the impl_ is the most used version :-) -
    but as Thorsten pointed out, other possibilities are used too

Hope that helps, and even more - I hope this does not start a flame
war :-)

Regards,
Kendy


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.