Do you have any C++ question? I will try to answer it.
But the target of a pointer to a const value can. And while sometimes that's good enough, often it's not really an option. Sometimes escape analysis is sufficient for the compiler to realize an external call won't affect content of a dynamic allocation, but not that often.
-
-
In the language model of C++ it can't and optimizer is allowed to optimized on this premise. Changing the value is an undefined behavior. Let me be clear, I'm not talking about any existing CPU or real computer. I'm talking about C++ model.
-
I think there might be a misunderstanding here. I'm talking about something like int foo(const sometype *p) { if (p->blub < 10) return 0; compute_something(); if (p->blub < 100) return 1; return -1; }
- 11 more replies
New conversation -
-
-
And strict aliasing only helps if the types are actually distinct. Far from a given.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.