3 ms·
It surprised me, cause I forgot that aliasing is a problem for C. Guess I'm one of today's 10,000.
by ReactiveJelly 4y ago
It surprised me, cause I forgot that aliasing is a problem for C. Guess I'm one of today's 10,000.
- jhgb 4y agoI'm sort-of, kind-of aware of the issue but what surprised me was how std::string pulls this into picture here. Is this because of what str[i] gets compiled into when str is a basic_string of chars? That seems non-obvious to me because I'm just accustomed to dealing with C++ strings as fairly opaque entities. If they somehow expose to the compiler that you're really manipulating characters via pointers, I can understand how this complicates things.