C++ Programming Style Guidelines

Pages: 12
Functions will often contain cross references, so usually you'll always want to declare your functions before you define them. Where exactly you do that is a matter of convention, though most of the time you'll end up putting your declarations in a header and the definitions in a separate compilation unit anyways, so you don't have that many degrees of freedom here (that you should actually use).
@Cubbi
(incidentally, in the corporate standard I'm following, the cpp file with the main function is not supposed to have any other functions at all)


That's the standard I've grown to like as well. The file with main should just be that: a main function, with as little code in it as possible, and the necessary include(s).

Mine usually only has a variable for the filename, an object of an algorithm-wrapper class that does the actual execution and some code for timing the run.
Topic archived. No new replies allowed.
Pages: 12