我知道在 C++ 中访问缓冲区边界是未定义的行为。
这是来自 cppreference 的示例:
int table[4] = {};
bool exists_in_table(int v)
{
// return true in one of the first 4 iterations or UB due to out-of-bounds access
for (int i = 0; i <= 4; i++) {
if (table[i] == v) return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
但是,我在 c++ 标准中找不到相应的段落。
谁能指出我在标准中解释这种情况的具体段落?
例如,我开发了电子邮件客户端。我知道某些服务器(例如imap.gmail.com)会缓存 SSL 会话。所以我想重用 SSL 会话(来自我这边的缓存)来减少服务器负载。
我使用boost::asio作为网络引擎。问题是: