-
Notifications
You must be signed in to change notification settings - Fork 19
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
Ideas for refactoring/pull requests #14
Comments
A couple more ideas:
|
Also:
This can be a bit tricky since some parameters and variables maybe should be used but aren't because the code was in the middle of having worked on, while others may be vestigial and no longer necessary. In cases where we're not sure, we can just comment out the name:
and leave some TODO or FIXME comments to mark it. |
I was actually working on these last night. ;) |
Feel free to help work on these! But avoid changing anything in thirdparty/ |
I've created a lot of tickets... the idea behind it that people can pick them up, work on them and solve them. Should be low hanging fruit. :) |
Small question: are you guys okay with this in-place lambda syntax? const int value = [...]()
{
// Several variables and calculations.
return result;
}(); I use it all the time because it's a very natural way for me to program and it keeps the surrounding scope clean. I haven't seen very much other code use it so I wasn't sure if it was a standard practice. Edit: lambdas are implemented on the stack, so they are low/zero-overhead, and are more likely to be inlined because their definition is known at the callsite. |
I'm ok with anonymous functions only if they are one-shots. |
Maybe this could be formalized into a secondary to-do list or task list somewhere (and the to-do list in the Readme could be moved into an actual
TODO.txt
file). Some of these are things that new contributors could handle.CMake is already set up for C++14. As @psi29a said, there are many C-ish things that could be replaced with their C++ equivalents (this also includes things like replacing for loops with range-based for,
std::find
,std::count
, etc.).Each change might require some considerations for the surrounding code, so when in doubt, just leave it alone. We do not want to introduce bugs because of "upgrades". You're free to ignore my suggestions -- these were just things I had in mind for getting rid of C/C++03 stuff.
NULL
tonullptr
strcpy()
tostd::string()
orstd::copy()
std::array
(orstd::string
in the case ofchar[]
)new/delete ptr
tostd::make_unique
auto
= default;
to virtual constructors/destructors with{ }
bodyreturn true/return false
if branches with singlebool
expressionenum
toenum class
if not too invasive (i.e., no added static_casts)(void)
from C++ parameter lists (only relevant in C, not C++)Vector{2,3,4}&
toconst Vector{2,3,4}&
where applicableVector{2,3,4}
classes (UnitX
,UnitY
,UnitZ
, etc.)sprintf()
tostd::snprintf()
,std::to_string()
, orstd::stringstream
override
to derived virtual methodstypedef struct
tostruct
atoi()
withstd::stoi()
The text was updated successfully, but these errors were encountered: