Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitpicks. #1

Merged
merged 5 commits into from
Aug 5, 2015
Merged

Nitpicks. #1

merged 5 commits into from
Aug 5, 2015

Conversation

tabbott
Copy link
Contributor

@tabbott tabbott commented Aug 1, 2015

You said you'd love feedback. Here's a bit to start.

tabbott added 5 commits July 31, 2015 20:51
My general rule is: use initializer lists except when you can't. Also,
don't write empty constructors / destructors [unless the destructor
actually needs to be virtual]. See here for an explanation:

http://en.cppreference.com/w/cpp/language/rule_of_three

The gist is: the compiler is required to generate these for you in the
relevant cases.

Also, class, struct, enum, and union definitions need a trailing
semicolon. Function definitions do not.
it is almost certainly std::size_t. Technically, it is
std::vector<T>::size_type. This may be relevant to your interests:

http://en.cppreference.com/w/cpp/language/range-for
don't do this:

    if (x == true)
        return true;
    else
        return false;

do this instead:

    return x;

Also, functions that always return true should just return void.
If an exceptional condition occurs, throw an exception.
@gatoravi
Copy link
Contributor

gatoravi commented Aug 5, 2015

Thanks a lot for this and the references!

gatoravi added a commit that referenced this pull request Aug 5, 2015
@gatoravi gatoravi merged commit 9bb59f9 into griffithlab:master Aug 5, 2015
gatoravi added a commit that referenced this pull request Apr 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants