blob: fd57538bc95f33e0788b2619f127209daf4225fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#include <string>
#include <stdexcept>
extern "C" int string_length() {
std::string text(4096, 'x');
text += std::to_string(123);
return static_cast<int>(text.size());
}
extern "C" void string_throw() {
try { throw std::invalid_argument("string failure"); }
catch (const std::exception &e) {
if (std::string(e.what()) == "string failure") throw;
}
}
|