News for hackers. Stuff that matters.
Re:Show HN: Space Invaders in C by tombert on Friday December 06, 2019 @01:18PM (#21724515)
I have to ask an honest question (as someone who is interested in emulation and old-game restoration as a whole): why C? Did you consider a newer hacker-news-friendly language like D or Rust?

(my usual disclaimer: I'm not asking this passive aggressively, I'm genuinely interested in the answer to this).

Re:Show HN: Space Invaders in C by mrfredward on Friday December 06, 2019 @02:16PM (#21725034)
I'm obviously not the author, but I can think of a good reason not to use rust.

The project works exactly as the original and recreates the memory state byte for byte, so like the original it has different tasks running at once that are reading and writing to shared memory. Rust's borrow check exists to prevent this sort of thing, because it is so hard to do it correctly or prove it is correct once you have done it. So to use rust, the author would have needed to either totally re-architect Space Invaders, or write the whole thing in ugly, non-idiomatic rust.

Rust simply doesn't let you do the things assembly and C programmers did all the time in 1978 (and with the complexity of our software now and the extra computing power, that's usually for the better). C, on the other hand, has at times been described as "portable assembly," which makes it a good choice for someone wanting to stay true to the original program flow.

Re:Show HN: Space Invaders in C by loadzero on Friday December 06, 2019 @05:04PM (#21726453)
This is a good answer, and does reflect a good chunk of the reason for picking C. Dealing with such low level tasks is what the language was made for.

The other big reason I used C, is that it is more of a lingua franca than something more modern, and will make the code more accessible to a wider audience.

Re:Show HN: Space Invaders in C by pcwalton on Friday December 06, 2019 @06:28PM (#21727121)
> Rust simply doesn't let you do the things assembly and C programmers did all the time in 1978 (and with the complexity of our software now and the extra computing power, that's usually for the better).

Rust does let you do those things. You could run this repo through c2rust and get a working Rust program.

It'll be ugly Rust code, though.

Re:Show HN: Space Invaders in C by _sbrk on Friday December 06, 2019 @05:47PM (#21726792)
I'm a hacker-news reader and I use C on a daily basis. Seems pretty friendly to me.

Every language has a problem that it is good at solving, and some languages express the underlying idea more clearly than others. In this case, the author has done a bang-up job picking a common, everyday language to solve the problem.

Re:Show HN: Space Invaders in C by fortran77 on Saturday December 07, 2019 @11:05AM (#21730940)
Well, it wouldn't have been "Space Invaders in C" if he had used Rust.