-
-
Notifications
You must be signed in to change notification settings - Fork 371
Coding Style and Idioms
Bob Carpenter edited this page Dec 7, 2013
·
31 revisions
For container indexes, use:
-
size_t
forstd::vector<S>
, -
int
forEigen::Matrix<S,R,C>
, and -
T::size_type
for template paramsT
that might be instantiated as either astd::vector<S>
orEigen::Matrix<S,R,C>
.
One could argue we should always use Eigen::Matrix<S,R,C>::size_type
for Eigen constructs just in case we ever decide that we want to change their default indexing from int
to something else. But int
should be OK for now because if we change the index type for some reason, the compiler will let us find instances.
Use two spaces for indentation. There are emacs modes to enforce this.
Whenever possible, keep lines to 80 characters or less. It makes it much easier to review pull requests, view diffs, etc.