close Warning:

Changes between Version 22 and Version 23 of Dev/CodingStandard


Ignore:
Timestamp:
12/13/11 14:12:03 (5 years ago)
Author:
vossg
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Dev/CodingStandard

    v22 v23  
    5555
    5656
    57 
    5857'''var names != type names, this is a ''must'' '''
    5958
     
    6463
    6564
    66 Whoever uses ''near, far, min, max, errno'' or the like as a variable or type name will be punished by C++
    67 
    68 ''forbiddance'' and forced to use ''java'' for at least ''four weeks''
     65Whoever uses ''near, far, min, max, errno'' or the like as a variable or type name will be punished by C++ ''forbiddance'' and forced to use ''java'' for at least ''four weeks''
    6966
    7067
     
    167164
    168165    /*!\brief prohibit default function (move to 'public' if needed) */
    169 
    170166    CLASSNAME(const CLASSNAME &source);
    171167
    172168    /*!\brief prohibit default function (move to 'public' if needed) */
    173 
    174169    void operator =(const CLASSNAME &source);
    175170
     
    181176
    182177
    183 
    184 Don't put inline method code into the `.h`, put it into `.inl` instead. You should declare the methods that you're going to inline `inline`, otherwise some compilers complain.
    185 
    186 
    187 
     178Don't put inline method code into the `.h`, put it into `.inl` instead.
    188179
    189180
     
    203194
    204195    VRMLWriteAction::registerLeaveDefault(
    205 
    206196        MaterialGroup::getClassType(),
    207 
    208197        osgTypedFunctionFunctor2CPtrRef<
    209 
    210198            Action::ResultE,
    211 
    212199            CNodePtr        ,
    213 
    214200            Action         *>(&VRMLWriteAction::writeMatGroupLeave));
    215201
     
    268254This is the area where most religious struggles happen... This is our style.
    269255
    270 
    271 
    272256Maximum line length is 79 characters. No line should have more than that.
    273257
    274 
    275 
    276258Indents are 4 spaces, no tabs should be used for indenting, as they will always confuse some people.
    277259
    278 
     260The new line character is the '''unix''' character '''\n''', not the '''windows''' combination '''\n\r'''
    279261
    280262We are not amused by setting block opening brackets (`{`) the K&R way. Block opening brackets should be placed into the next line.
    281263
    282 
    283 
    284264{{{
    285265
     
    287267
    288268class Foo
    289 
    290269{
    291270
     
    295274
    296275void bar(void)
    297 
    298 {
    299 
     276{
    300277    if(fooBar == true)
    301 
    302278    {
    303 
    304279        ...
    305 
    306280    }
    307281
    308 
    309 
    310 
    311 
    312282    while(fooBar == false)
    313 
    314283    {
    315 
    316284        ...
    317 
    318285    }
    319 
    320286};
    321287
     
    349315
    350316if((something + 2) == 5)
    351 
    352 {
    353 
     317{
    354318    doSomething;
    355 
    356319}
    357320
     
    369332
    370333if((something + 2) == 5)
    371 
    372334    something = something * 3 + 2;
    373335
     
    385347
    386348if((something + 2) == 5)
    387 
    388 {
    389 
     349{
    390350    if((something + 2) == 4 )
    391 
    392351       doSomethingSimple;
    393 
    394352}
    395 
    396353else
    397 
    398 {
    399 
     354{
    400355    doSomethingElse;
    401 
    402356}
    403357
     
    414368void foo(Int32 val1, Int32 val2);
    415369
    416 
    417 
    418370void foo(Int32 val1, Int32 val2)
    419 
    420 {
    421 
     371{
    422372    bar(val1, val2);
    423 
    424373}
    425374
     
    481430
    482431switch(hugo)
    483 
    484 {
    485 
     432{
    486433    case HUGO0:     
    487 
    488434        doSomethingCool();
    489 
    490435        break;
    491436
    492 
    493 
    494437    case HUGO1:     
    495 
    496438    {
    497 
    498439        UInt32 tempint = getTempInt();
    499 
    500440        doSomethingCooler(tempint);
    501 
    502441    }
    503442
    504443    break;
    505444
    506 
    507 
    508445    case HUGO2:     
    509 
    510446        veryShort();   
    511 
    512447        break;
    513448
    514 
    515 
    516449    case HUGO3:     
    517 
    518450        veryShort2(); 
    519 
    520451        break;
    521452
    522 
    523 
    524453    default:       
    525 
    526454        nothingCoolToDo();
    527 
    528455        break;
    529 
    530456}
    531457
     
    546472typedef MyClass::HelperClass HelperClass;
    547473
    548 
    549 
    550474switch(hugo)
    551 
    552 {
    553 
     475{
    554476    case HelperClass::HUGO0:
    555 
    556477    {
    557 
    558478        doSomethingVeryCoolWithUnsuspectingClass(
    559 
    560479            this->getUnsuspectingClass());
    561 
    562480    }
    563481
    564482    break;
    565483
    566 
    567 
    568484    case HelperClass::HUGO1:
    569 
    570485    {
    571 
    572486        UnsuspectingClass & victim = this->getUnsuspectingClass();
    573487
    574488        suspectClassInstance->makeInconspicious(victim,
    575 
    576489                                                HelperClass::NOW);
    577 
    578490    }
    579 
    580491    break;
    581492
    582  
    583493
    584494    default:
    585 
    586495    break;
    587 
    588496}
    589497
     
    635543
    636544class Foo
    637 
    638 {
    639 
     545{
    640546  public:
    641547
    642 
    643 
    644548    struct FooHelper
    645 
    646549    {
    647 
    648550        UInt32 _val1;
    649 
    650551        UInt32 _val2;
    651 
    652552    };
    653 
    654553};
    655554
     
    669568
    670569class Foo
    671 
    672570{
    673571
    674572  private:
    675573
    676 
    677 
    678574    struct FooHelper;
    679575
    680576    friend struct FooHelper;
    681577
    682 
    683 
    684578    struct BarHelperForFooHelper
    685 
    686579    {
    687 
    688580    };
    689581
    690 
    691 
    692582    struct FooHelper
    693 
    694583    {
    695 
    696584        BarHelperForFooHelper _val1;
    697 
    698585        UInt32                _val2;
    699 
    700586    };
    701 
    702587};
    703588
     
    757642
    758643class OSG_SYSTEMLIB_DLLMAPPING Node : public AttachmentContainer
    759 
    760644{
    761645
     
    801685
    802686    /*---------------------------------------------------------------------*/
    803 
    804687    /*! \name                   Destructors                                */
    805 
    806688    /*! \{                                                                 */
    807689
    808 
    809 
    810690    virtual ~BoxVolume(void);
    811691
    812 
    813 
    814692    /*! \}                                                                 */
    815693