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¶
- Obviously, make sure it is licensed under a compatible license as the first step.
- GPL code is not compatible.
- 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.
- MIT is OK
- BSD is OK
- Be sure to copy the copyright notice verbatim into the source file and document the origin of the code.
- Add the details into the README.txt
- Algorithm credits can go in section 5
- Source code used in Nightshade requiring notice goes in section 6
- Dynamically linked libraries and license information goes in section 7