distributed's project 1 is a pain
Post created: 2018-01-29
I'm pretty happy that I don't have to go into lab tomorrow.. well, today.. extolling the virtues of C.
The core concept behind 15-440's project 1 (implement RPC) is very simple. Hijack those function calls, pack everything into a box, ship them to your server, get the results back, apply them locally and you're done! The handout says as much.
But the devil is in the details, and so I've just spent the better part of my weekend wrangling with C and string processing. In retrospect, my initial JSON parser idea would have been easier to formally specify and test, and I regret not implementing it. I'm not looking forward to recursive data structures either, with my current iteration of "let's reinvent CSV" that everybody goes through now and then.
It's especially painful coding in C when you know that all these memory errors would have been compile time checked at Rust. Sure, Rust crates are a little young, but I did lose a day to valgrind somehow reassigning my assigned-exactly-once file descriptor. I'm fairly sure I've ruled out overflow, so I still have no idea why it does that - a question for another day. Well, you never really appreciate languages until you see the salvation they offer. I still wonder how much easier this project would have been during the Fall in Go, though.
Should I throw an ASCII dragon into my stub file? The generic macro for marshalling numbers isn't that bad.
It also makes sense when you think about how it works, but gcc warnings are pretty useless once you go variadic. And trying to pass va_list around was one heck of a minefield. On the plus side, I understand them a little better now.
But more importantly, done for the day! Just have to keep going.