Yo whatup

  • 0 Posts
  • 160 Comments
Joined 1 year ago
cake
Cake day: September 28th, 2023

help-circle







  • Nuclear is very expensive to build it’s the cheapest to maintain. Even accounting for horrible disasters like Chernobyl it’s safer and less polluting. But yes, renewables are great! Most of our power where I live is from a dam. My grandpa had his house heated primarily via solar energy. They generated enough power through solar that they were able to sell it off to the energy dudes. When solar was bad they’d get power from the nearby wind turbines or the dam. All this stuff is great, it’s way better than coal but a single nuclear plant would out perform all of that energy generation and ultimately, cost less.







  • I’d probably say it depends but I’m no Rust expert and I have no direct experience with C (though quite familiar with C++).

    Basically I’d expect writing C to be easy, but not safe. IE you can quickly and easily write C that compiles but has runtime issues. Rust for the most part will catch everything but logic issues during/before compilation meaning once the program runs you’ll have very high confidence in it’s runtime behavior leading to time spent “fighting the compiler” instead of figuring out wtf is going wrong at runtime.


  • What Rust provides is statically guaranteed memory safety. Some C++ types will prevent memory issues however the language itself is unsafe. Playing with raw pointers is just as valid as using std::unique_ptr. In Rust however you must sign a contact (using unsafe) in order to play with raw pointers. Unsafe is you the programmer promising that you followed the rules. This is like how C++ says it’s illegal to write UB and your program will break (and it’s your fault) but enforced through a special type of block


  • Yes Rust is harder to write than C, that’s basically by design as it’s due to the statically guaranteed memory safety. That’s pretty magical. C doesn’t have that and neither does C++ even with smart pointers and such. Rusts unsafe keyword is poorly named, what it actually does is tell the compiler that you the programmer guarantee Rusts rules are upheld within the unsafe block.

    For example

    Access or modify a mutable static variable

    That is a global, that’s incredibly hard to impossible to statically prove it’s safely done, so you have to do it in an unsafe block. So you violating Rusts rules within an unsafe block is actually using the unsafe block wrong. That’s not what it’s for