News for hackers. Stuff that matters.
Re:Near-duplicate features of C++ (2017) by nayuki on Saturday May 25, 2019 @07:29AM (#20008387)
Rust is a relatively new programming language that features nearly all the good parts of C++ (e.g. struct, reference, RAII, move semantics, generics) and almost none of the bad parts (e.g. duplicate features, cryptic syntax, undefined behavior).

Your example in Rust would read like this:

    // Definition
    fn foo(a: u8,  b: &u8,  c: &mut u8) -> i32 {
        a = 0;  // Local change only
        println!("{}", *b);  // Read pointee
        *c = 1;  // Write pointee
        return 2;
    }
    
    // Call site
    let bar: u8 = 3;
    let baz: u8 = 4;
    let mut bajinga: u8 = 5;
    foo(bar,  &baz,  &mut bajinga);
Re:Near-duplicate features of C++ (2017) by steveklabnik on Saturday May 25, 2019 @11:23AM (#20009520)
You shouldn’t need the type annotations on the three variables, by the way.