4 ms·
I wish this wasn't downvoted as for me its the right answer. unsafe in rust is a blank cheque for the compiler. Doing anything complicated in it is almost gua
by hyperman1 3y ago
I wish this wasn't downvoted as for me its the right answer.
unsafe in rust is a blank cheque for the compiler. Doing anything complicated in it is almost guaranteed to have UB somewhere. You decide to disable safety.
If possible, write the safe but tedious code. Then measure. Only when you're sure unsafe is worth it should you take out the big cannon. Write a km of comments proving this code needs and deserves unsafe. Writing the tedious code is less time consuming than debugging the mess.
I wish the video author documented why he choose unsafe here. Was it measured and worth it in an older version of rust? Or a folly of youth (which is fine, as long as you learn from it, been there done that paid the time debugging my stupidity)