4 ms·
> I'm suspicious of restrict. It seems like playing with fire, and anecdotally it seems common to run into compiler optimisation bugs when using it because it's
by saagarjha 7y ago
> I'm suspicious of restrict. It seems like playing with fire, and anecdotally it seems common to run into compiler optimisation bugs when using it because it's exercised so little.
On the contrary, I wish C++ had restrict in the standard, for exactly the reasons mentioned: it can help the optimizer in certain cases.
- cozzyd 7y agoIndeed, auto-vectorization usually won't work without it...
- lochsh 7y agoThis is all totally fair -- I've never used restrict, so it's hard for me to have a useful opinion on it. I think it's easy to dismiss things that can help optimisation when you've never seen their effect first-hand. I imagine if I'd had an experience where I'd used it to great advantage I'd be wishing it was in the C++ standard too :)