Changes between Version 11 and Version 12 of Coding_Conventions


Ignore:
Timestamp:
Feb 3, 2012, 12:15:13 AM (12 years ago)
Author:
historic_bruno
Comment:

Experiment a bit with processors (code syntax highlighting)

Legend:

Unmodified
Added
Removed
Modified
  • Coding_Conventions

    v11 v12  
    1818 * All source files (.cpp, .h) must start with the following GPL license header, before any other content:
    1919{{{
     20#!cpp
    2021/* Copyright (C) 2012 Wildfire Games.
    2122 * This file is part of 0 A.D.
     
    3940 ''Exception:'' Code in `source/lib/` (and a few other files) should use the MIT license instead:
    4041{{{
     42#!cpp
    4143/* Copyright (c) 2012 Wildfire Games
    4244 *
     
    6466 * Wrap header files in include guards, using the name `INCLUDED_`''filename'', e.g. the file `Foo.h` should say:
    6567{{{
     68#!cpp
    6669#ifndef INCLUDED_FOO
    6770#define INCLUDED_FOO
     
    8285 * Indent braces and use whitespace like
    8386{{{
     87#!cpp
    8488int CExampleObject::DoSomething(int value)
    8589{
     
    102106 * Write switch statements like
    103107{{{
     108#!cpp
    104109switch (n)
    105110{
     
    133138 * For error cases that could be triggered by modders (e.g. invalid data files), use
    134139{{{
     140#!cpp
    135141LOGERROR(L"Failed to load item %d from file %ls", i, path.c_str());
    136142}}}
     
    144150 * Use [http://www.doxygen.org/ Doxygen] comments (explained [http://www.stack.nl/~dimitri/doxygen/docblocks.html here] as !JavaDoc style), e.g.
    145151{{{
     152#!cpp
    146153/**
    147154 * A dull object for demonstrating comment syntax.
     
    176183 * For portability, use the following formats for printf-style functions:
    177184{{{
     185#!cpp
    178186printf("%s", "char string");
    179187printf("%ls", L"wchar_t string");
     
    213221 * Use quotes around the key names in object literals:
    214222{{{
     223#!js
    215224var x = 100, y = 200;
    216225var pos = { "x": x, "y": y };
     
    223232 * To convert a string to a number, use the "`+`" prefix operator (not e.g. `parseInt`/`parseFloat`):
    224233{{{
     234#!js
    225235var a = "1";
    226236var b = a + 1;     // string concatenation; b == "11"