使用子字符串构造函数构建字符串 - 调试 - 当自动跳过代码时

Building string using substring constructor- debugging - when step over code continues automatically?

本文关键字:字符串 代码 调试 构造函数 构建      更新时间:2023-10-16

我有以下代码:

//Open a file
//Put contents in to a char array
char* current_bytes = static_cast<char*>(region->get_address());
//Create a string 
std::string my_string(current_bytes, x, 16);

x = 202

current_bytes包含 100,000,000 字节

当我调试(在 Visual Studio 中的调试模式下)并且我跳过字符串构造函数时,代码会自动继续??

我确实认为这可能是因为我在堆栈上创建了字符串,所以我尝试了这个:

std::string my_string = new std::string(current_bytes, x, 16);

但这也做了同样奇怪的事情,当我在调试模式下跨过它时,代码会自动继续......

为了使用 VS 调试构造函数,您需要在其中设置一个断点,否则它将继续。