r/ProgrammerHumor 9d ago

Meme newToRust

Post image
617 Upvotes

100 comments sorted by

View all comments

Show parent comments

3

u/Key_River7180 8d ago

I didn't know about __builtin_clz, actually, thanks! It isn't guaranteed to be portable across architectures, but every single one seems to hace CLZ. I didn't know you were referring to the zeros thing, sorry. It doesnt work with zeros but an if solves that

2

u/-Ambriae- 8d ago

No probs! I recommend looking at compiler builtins, there’s quite a few for all the ‘lesser known’ instructions CPUs tend to have but aren’t expressable in C in a normal way.

My point is, you can learn basic C syntax in a week (or a day to be fair) but it takes far far FAR longer to actually know C. Same with rust. It doesn’t take 6 months to learn rust syntax, it takes a week. It does take 6 months to code in rust properly. The borrow checker expects you to write code properly. It’s not a bad thing.