4 ms·
Memory corruption, now on Android! Just gonna leave this here: https://safecpp.org/draft.html#the-call-for-memory-safety https://safecpp.org/draft.html#the-cal
by smarx007 2y ago
Memory corruption, now on Android!
Just gonna leave this here: https://safecpp.org/draft.html#the-call-for-memory-safety https://safecpp.org/draft.html#the-call-for-memory-safety
P.S. Was discussed on HN recently: https://news.ycombinator.com/item?id=41528124 https://news.ycombinator.com/item?id=41528124
P.P.S. The author has a great YT channel with awesome embedded systems projects: https://www.youtube.com/playlist?list=PLDRymMFQl3Nktk_pjlUP_wbLIXre3sody https://www.youtube.com/playlist?list=PLDRymMFQl3Nktk_pjlUP_...
- asveikau 2y agoAny effort to make android more accessible to a C ABI with a simple toolchain can probably also serve as an FFI to other languages.
- fbn79 2y agoIf works with C why not Rust
- theyknowitsxmas 2y ago[flagged]
- nine_k 2y agoInterfacing with C from Rust is harder, and Rust has fewer cross-compile targets. I'd expect Zig to be an easier deal here, with its zero-impedance interface with C.
- Yoric 2y agoIn my experience, C <-> Rust works quite well, except when the C API relies too much on macros. C++ <-> Rust is much more annoying.
- kelnos 2y ago> Interfacing with C from Rust is harder Sure, harder, but not really all that difficult. Run bindgen over the NDK headers and see what happens. Sure, for ergonomics you'll want to write safe Rust wrappers. After that's done once, it's done. > Rust has fewer cross-compile targets. Not really an issue here. Rust supports all the targets Android runs on. Natively, even: $ rustup target list | grep android aarch64-linux-android arm-linux-androideabi armv7-linux-androideabi i686-linux-android thumbv7neon-linux-androideabi x86_64-linux-android
- tonetegeatinst 2y agoZig also much better at memory as far as I can tell. Only reason I found out about it was some random twitch clip I can't remember, but parts of zig seem to be more readable and easier to learn than rust. Granted I will not stop loving the C language even as someone who has only begun to learn C programming but I do recognise the need for secure software. Check out this blog on zig memory safety: https://www.scattered-thoughts.net/writing/how-safe-is-zig/ https://www.scattered-thoughts.net/writing/how-safe-is-zig/ (Not my blog, just a blog I found that discusses zig) Zig is not at 1.0 yet so its a bit behind rust from what iv seen online. One I manage to get C under my belt and get good at writing los level stuff in that language, I might attempt to learn rust or zig.
- smarx007 2y agoYes, I think Zig is the most suitable language (of Zig, Rust, Go, ...) to replace C in various (systems-related) contexts including embedded/RTOS.