3 ms·
Just occurred to me, since Rust has LLVM IR asm directives, can't you write a portable goto in an inline function that jumps directly to pointers? Publish that
by Subsentient 6y ago
Just occurred to me, since Rust has LLVM IR asm directives, can't you write a portable goto in an inline function that jumps directly to pointers? Publish that crate to crates.io? Problem solved.
- steveklabnik 6y agoRust stable still does not have inline assembly. Additionally, we have moved away from the "whatever LLVM does" feature, and built our own. There are significant language issues with doing something like this. Yes, in theory, you could do something. But it's going to be very unsafe, and very error prone.
- Subsentient 6y agoI do see that the LLVM IR thing isn't being used anymore. I hope asm! ends up in stable Rust soon, seems like a pretty big oversight. Then again, MSVC dropped inline ASM altogether, which seems really dumb. One of these days I'm going to write a crate that easily enables doing all the unsafe, dangerous, stupid things that C programmers want to do, including gotos, with no safety checks or variable lifespan verification of any kind. And I'm going to name it "evil". :^) I will do it, eventually. ^^
- taxcoder 6y agoAs long as you don't name it evil-mode.
- tijsvd 6y agoJust write your parser as a collection of functions that can use tail calls. You should end up with a similar structure, i.e. a block of code with jumps instead of calls. Even in C++ I'd prefer that over a goto-based system (unless generated).