You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Making a list of various changes to make this code more up-to-date. Most of these are easy on their own. It will just take time to do them all. I've already finished most of these kinds of changes to Umbra.
TCODList should be replaced with std::vector in all cases.
Remove new/delete from libtcod types. These can be treated as values without major issues. Any exceptions can use smart pointers instead of new.
Pointer types should express ownership, ideally with std::unique_ptr, but also std::shared_ptr if necessary. Non-owning pointers would still be raw of course.
Class attributes should be initialized. Just put {}; at the end of simple types rather than = nullptr; or = 0;. Any defaults should be moved from the class constructor code to the class itself.
Pointers to strings should be replaced with std::string in many cases. Mostly in non-contexpr cases such as class attributes or local variables. In some cases null strings should be replaced with empty strings. Always replace strdup.
#define X Y constants should generally be replaced with static constexpr auto X{Y};/static constexpr auto X = Y; constants.
#define macros should all be replaced with constexpr functions.
Low level calls such as memcpy and strcmp should generally be replaced with high level operations.
C-style arrays like int foo[2] should be replaced with std::array<int, 2> foo{}, etc.
File operations should use C++17 <filesystem>.
For-loops over containers should prefer ranged-based loops. for (auto& x : y);
Many class methods are missing const, noexecpt, and [[nodiscard]] qualifiers.
Empty constructors and destructors should use = default;, they should not have an empty function in the source.
Small functions with few or no dependencies should be moved inline.
Functions which take pointers, but don't handle nullptr, should be changed to take references.
Macros such as MIN or CLAMP should be replaced by their C++ functions.
Virtual class overrides are missing the override qualifier.
String formatting functions should use fmt.
Temporary local variables which don't change should be qualified with const.
Making a list of various changes to make this code more up-to-date. Most of these are easy on their own. It will just take time to do them all. I've already finished most of these kinds of changes to Umbra.
TCODList
should be replaced withstd::vector
in all cases.new
/delete
from libtcod types. These can be treated as values without major issues. Any exceptions can use smart pointers instead ofnew
.std::unique_ptr
, but alsostd::shared_ptr
if necessary. Non-owning pointers would still be raw of course.{};
at the end of simple types rather than= nullptr;
or= 0;
. Any defaults should be moved from the class constructor code to the class itself.std::string
in many cases. Mostly in non-contexpr cases such as class attributes or local variables. In some cases null strings should be replaced with empty strings. Always replacestrdup
.#define X Y
constants should generally be replaced withstatic constexpr auto X{Y};
/static constexpr auto X = Y;
constants.#define
macros should all be replaced withconstexpr
functions.memcpy
andstrcmp
should generally be replaced with high level operations.int foo[2]
should be replaced withstd::array<int, 2> foo{}
, etc.<filesystem>
.for (auto& x : y)
;const
,noexecpt
, and[[nodiscard]]
qualifiers.= default;
, they should not have an empty function in the source.MIN
orCLAMP
should be replaced by their C++ functions.override
qualifier.fmt
.const
.std::variant
.In general follow the C++ Core Guidelines.
The text was updated successfully, but these errors were encountered: