Reply to post: Re: Kinda sad.

C++ still rules the Chromium roost though Rust has caught our eye, say browser devs

Anonymous Coward
Happy

Re: Kinda sad.

> Rust's equivalent of a switch-case block (called match) does not allow you to fall through it.

switch statement fallthrough in C/C++ is not an error, unless the programmer didn't intend it in the first place, but let it happen by mistake. So, I wouldn't count disallowing switch statement fallthrough as a feature.

Please allow me to introduce you to Duff's Device, which is a way of doing loop unrolling in C/C++ -- for loops with a known compile-time trip count -- based entirely on switch statement fallthrough.

Also, -Wimplicit-fallthrough both in GCC and clang.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon