Project

General

Profile

Code Formatting

Grab the attached xml file and import it into Eclipse’s code formatting section via Properties→C++ General→Code Style. This helps keep code style consistent accross all C++ source files. It is a mildly modified version of K&R style. For large sections of code that were written in another editor and need to be reformatted, highlight the region in Eclipse, right click it and select Source→Format. Eclipse will use the current code style to reformat the code snippet automatically.

When creating a new file, grab an existing copyright header and change the file author line and years if needed. If there are additional copyright/credits, put these immediately below. This helps with automating changes.

Best Practices for Reusing External Code

  1. Obviously, make sure it is licensed under a compatible license as the first step.
    1. GPL code is not compatible.
    2. LGPL code could potentially go into the nsutil library if dynamically calling a new library is not desired. In this case, check that the LGPL versions are compatible.
    3. MIT is OK
    4. BSD is OK
  2. Be sure to copy the copyright notice verbatim into the source file and document the origin of the code.
  3. Add the details into the README.txt
    1. Algorithm credits can go in section 5
    2. Source code used in Nightshade requiring notice goes in section 6
    3. Dynamically linked libraries and license information goes in section 7

K&R_Digitalis.xml Magnifier (17.2 KB) Trystan Larey-Williams, 04/15/2013 04:09 PM