3 ms·
You can express what you're talking about (non aliasing mutable pointers) for free, at compile time. In fact, you can't express this in C (or, restricted, what
by staticassertion 9y ago
You can express what you're talking about (non aliasing mutable pointers) for free, at compile time.
In fact, you can't express this in C (or, restricted, whatever), so I do wonder if your assumption that because it's UB it'll compile to the optimal code is true.
- CJefferson 9y agoI think you are thinking about the memory that 'in' and 'out' point to aliasing each other. That's handled with the "restricted" keyword, as you say. I'm talking about something else, the issue of 'in' and 'out' pointing into the stack, so writing to them changing the value of the local variables. That is basically treated as UB by every C compiler, and no compiler I am aware of provides any switches which would make it easier to handle, it's just horrible and your code behaves in different ways depending on the compiler and optimisation level.