Skip to content

Fix most compiler warnings

Steven Franzen requested to merge sfranzen/OpenAuraSDK:compiler-warnings into master

They were starting to drive me crazy. I still get a few "defined but not used" warnings concerning some const char*[] arrays. I would recommend replacing these with either a std::array<std::string, ...> or a std::map<int, std::string> if the intention is to give a human-readable name to some integral/enum type, which can then simply be returned as myMap[val]. In general std::array is preferable to a raw array and std::string to a char array/pointer.

Furthermore I recommend using the range-based for, for (auto item : container), in place of any "raw" (index-based) loop where the index is unimportant and one simply needs to do something for all elements of a container. The loop variable can be made auto& or auto const& if a (const) reference to the container element is more appropriate. This avoids having to declare the right type of index or element in every loop.

Merge request reports

Loading