Closed OpatrilPeter closed 4 years ago
Yes, the C++ standard defines what()
to return a null-terminated const char *
string, hence the issue cannot be solved on that end. One could make a default-Stringizer
for strings in Snowhouse that converts non-printable characters (like \0
) to something printable. I am however not sure if this is always desirable...
As I see it, a major use of this Stringizer is to be able to compare values, thus it seems like a sensible default to highlight otherwise undetectable differences.
I close this issue here; the respective issue is in Snowhouse (banditcpp/snowhouse#40). However, I have no idea when I get to it.
In current solution, following code
leads to error:
(IMHO it should print what printing the std::string would -
abcdef
- or in ideal world, something likeabc\x00def
) The message for the exception is generated correctly, problem lies in printing it in failure_formatter: it useswhat()
method which returnsconst char *
, so it simply ends on first \0 occurence.