Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C vs Rust

Name: Anonymous 2015-02-13 1:07

C:
int main(int argc, char **argv) {
int r;
if(argc > 1) {
r = atoi(argv[1]);
} else {
usage();
exit(EXIT_FAILURE);
}
}


Rust:
fn main() {
let argv: Vec<Result<String,OsString>> = std::env::args()
.map(|x| x.into_string())
.collect();

let r = match argv.get(1) {
Some(x) => match x.parse::<i32>() {
Ok(v) => v,
Err(_) => {
show_usage();
panic!()
},
},
None => {
show_usage();
panic!()
}
}
}


Type explosion is to be expected. Do notation could have been used to keep the control logic as clean as C, but Rust is not HASKAL and never will be anything like HASKAL and you're an asshole for wanting to write readable code you filthy shit fuck.

Name: Anonymous 2015-02-16 8:44

oh and what's up with everyone converting to reference counting to 'get away from the GC'

refcounting is a form of GC and is far, far slower than a proper GC, and there's no real proper way to defer cleaning up refcounting for an 'opportune' time like with a 'real' GC unless you... introduce a 'real' GC.

The idea that malloc/free has no overhead is absolutely ridiculous too, as if GCs suddenly make memory management slow. Realtime programming is done by never using anything except stack memory and preallocated buffers, GC or not.

rust feels like a meme language made by people who have never really done any form of low level programming

t. someone who writes embedded software for medical devices in pascal for a living

Name: Anonymous 2015-02-16 9:25

The guy who was trying to make an OS in Rust gave up, and switched to the Nim language.

https://github.com/ckkashyap/rustix/issues/8

>>47
Like SJWs trapping you with their political correctness, Rust traps you in its boilerplate bureaucracy.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List