Re:Kirei is a work-in-progress keyboard library written in Zig
by bluGill on Tuesday January 30, 2024 @01:10PM
(#39193515)
I'd say Safety, speed, and concurrency in that order. When Rust advocates talk about the borrow checker I - as a C++ developer - get interested. I can get similar safety and speed from C++ if I use modern C++, but it is too easy to drop back to the unsafe C++ even when modern C++ does the job. (You can drop to unsafe rust if you need, but it isn't as easy, and thus I would expect that Rust developers are not doing that unless they have a real need)
[ Parent
| on HN ]
Re:Kirei is a work-in-progress keyboard library written in Zig
by jiripospisil on Tuesday January 30, 2024 @01:47PM
(#39193991)
> I can get similar safety and speed from C++ if I use modern C++
Which modern C++ feature prevents data races?
Re:Kirei is a work-in-progress keyboard library written in Zig
by kimixa on Tuesday January 30, 2024 @02:13PM
(#39194303)
RAII mutex locks are a pretty good tool. But like all "modern" c++ features still require programmer diligence to use correctly. Though there are likely other tools outside a compiler error to help enforce this, like static analyzers, or even thread sanitizer to help detect possible issues on a running system.
And just like rust do little to protect against general race conditions, deadlocks, or the many other logic issues you can pretty easily hit around threading. Looking back at my experience around issues that involve threads, I suspect the vast majority of issues I see aren't data races.
Re:Kirei is a work-in-progress keyboard library written in Zig
by jiripospisil on Thursday February 01, 2024 @04:35AM
(#39214182)
> And just like rust do little to protect against general race conditions
IIRC those should be impossible if you avoid `unsafe`.
Re:Kirei is a work-in-progress keyboard library written in Zig
by bluGill on Tuesday January 30, 2024 @03:12PM
(#39195094)
Good architecture. Which isn't a c++ feature, but data races are not a big problem in my system because our architecture makes this easy. (We use qt signals/slots for cross thread messages)