Issues with Pedantic compiling
Hey, while installing the library in my project i got 2 compiler warnings due to my pedantic settings ("/W4" under Windows, "-Wall -Wextra -Werror -Wno-long-long -Wpedantic" under linux).
It would be cool if you could fix them in the original code, this is the diff i used to fix both errors, however you should have a brief look the solution because i just started working with c++:
1st Error: compiler warning because of possible lost of data when converting size_t to unsigned 2nd Error: isspace returns an int, but the function should return a bool
backward.hpp
@@ -435,7 +435,7 @@ struct Trace {
addr(0), idx(0) {}
explicit Trace(void* addr, size_t idx):
- addr(addr), idx(idx) {}
+ addr(addr), idx(unsigned(idx)) {}
};
struct ResolvedTrace: public Trace {
@@ -1520,7 +1520,7 @@ public:
// What a good boy am I.
struct isspace {
bool operator()(char c) {
- return std::isspace(c);
+ return std::isspace(c) != 0;
}
};
We should probably change the type of the attribute idx to size_t.
We should probably change the type of the attribute
idxtosize_t.
And compile with warnings==errors. There's some more warnings in https://github.com/bombela/backward-cpp/blob/5ffb2c879ebdbea3bdb8477c671e32b1c984beaa/backward.hpp#L3618 ff (I suppose, I don't have the git version) due to the conversion from size_t to DWORD.