Live data from Hacker News

Switching to C over 'Modern' Programming Languages

devtails.xyz

91–100 of 170 posts

Re: Switching to C over 'Modern' Programming Languages

#91
post #89
post #86

Earlier quoted context omitted.

> It's funny how both C and LISP programmers seem to suffer from NIH to the point that they'll roll their own just for the heck of it rather than to first see if there is a library that they can use. Well, not sure about the LISP programmers, but C programmers have a good reason: they work under different environments (from embedded to Windows, legacy UNIX, the latest Ubuntu, ...) and also have different needs, regar…

What exactly is a problem with C++’s strings, or especially Rust’s? Everything you mentioned can be controlled as explicitly as you want. The only problem is C is simply not expressive enough to have proper abstractions like that.

>What exactly is a problem with C++’s strings, or especially Rust’s? Everything you mentioned can be controlled as explicitly as you want.

Everything else, however, cannot.

Re: Switching to C over 'Modern' Programming Languages

#92
post #33
post #30

Earlier quoted context omitted.

While I agree, I also have to say that Rust does a lot more than just solve some specific C and C++ issues. It doesnt solve all of them (e.g. logic errors, so if thats 90% of your issues you wont benefit too much), it repeats some design issues of C++ (massive complexity from the start, many ways to do the same thing), and implements a C-like unsafe{} language anyways. If Rust was just C but with strong typing, a bor…

> But it isnt - its a whole different beast which by far is not perfect and repeats many issues it didnt need to repeat (e.g. terrible async like python). Not gonna lie, I don't see too much value in async, but that said, I can see where they (the Rust devs) are coming from. It was an oft requested feature, and it was in the pipeline for ages, leading to Rust dev burnout. That said Rust team is working on making it f…

Not closures - async runtime.

Re: Switching to C over 'Modern' Programming Languages

#93
post #48
post #11

Earlier quoted context omitted.

“I don’t get much programming done these days, what with all the goat herding…”

You mean atom moving? I just move atoms until the program I desire is on the computer.

Obligatory xkcd https://xkcd.com/378/

Re: Switching to C over 'Modern' Programming Languages

#94
post #91
post #89

Earlier quoted context omitted.

What exactly is a problem with C++’s strings, or especially Rust’s? Everything you mentioned can be controlled as explicitly as you want. The only problem is C is simply not expressive enough to have proper abstractions like that.

> What exactly is a problem with C++’s strings, or especially Rust’s? Everything you mentioned can be controlled as explicitly as you want. Everything else, however, cannot.

Like what? C++ and Rust can do everything C can.

Re: Switching to C over 'Modern' Programming Languages

#95

Earlier quoted context omitted.

"Rust forces me to think a little bit more [..]" My reaction to that has always been that it forces us to think about the things we would have had to think anyways if we wanted to create reasonably reliable and secure software. So in the end if saves work, even if it doesn't appear like that at first.

The other side of the medal (especially for game development), is that in the higher level parts of game code you need quick turnaround times for experimentation and tweaking, and most of that code won't even make it into the final product (so all the upfront time you spent thinking about proper architecture and ownership details is wasted up there). The traditional solution is to have different languages for differe…

This is my main reason for not thinking that rust is good for games - a quick prototype / test / reject approach is important

Re: Switching to C over 'Modern' Programming Languages

#96

Earlier quoted context omitted.

> C gives you enough rope to shoot yourself in the foot. If this was intended to illustrate the unexpected consequences of undefined behavior it succeeded remarkably well!

Undefined Behaviour was a very late 'addition' to C, it only became necessary when C was standardised around 1990. And only after two more decades passed, UB became an actual problem when compiler vendors decided that it's fine to exploit it for optimization tricks.

Did you miss their point? They merely used UB, correctly, as a term we all do recognize today.

I will utterly kill all humor by explaining it:

They made a funny observation about a thing that happens. The thing that happens is (today) called UB. The funny observation is that that comment kind of exhibited the outward appearance of what the effects of UB could look like.

It began reciting one metaphore, "enough rope to hang yourself" but mid-way unexpectedly switched to a different metaphore "shoot yourself in the foot", producing a combined invalid nonsensical output. As though a program suffered some UB in the routine for looking up and printing metaphores.

The comment author might have done it on purpose. Maybe they intended to make exactly that joke.

The history of the term UB has no more bearing than the history of any of the other words used.

Re: Switching to C over 'Modern' Programming Languages

#97

Earlier quoted context omitted.

The other side of the medal (especially for game development), is that in the higher level parts of game code you need quick turnaround times for experimentation and tweaking, and most of that code won't even make it into the final product (so all the upfront time you spent thinking about proper architecture and ownership details is wasted up there). The traditional solution is to have different languages for differe…

This is my main reason for not thinking that rust is good for games - a quick prototype / test / reject approach is important

Don't games work by an engine which doesn't have a lot of rando changing user facing features, that could be rust. And the engine provides a dsl that is the high level user facing rapid change thing?

Re: Switching to C over 'Modern' Programming Languages

#98
post #94
post #91

Earlier quoted context omitted.

> What exactly is a problem with C++’s strings, or especially Rust’s? Everything you mentioned can be controlled as explicitly as you want. Everything else, however, cannot.

Like what? C++ and Rust can do everything C can.

They literally cannot. For one, neither C++ or Rust conform to standard C, meaning they already deviate from what C does on a basic level.

Their industry uses are highly different as well. C is almost a requirement for embedded systems, and while C++/Rust can be used there, they’re simply too complex and in Rust’s case additionally too young to be adopted. C++, and possibly Rust (if it can get its act together), are more used in high level programming, as that’s what they’re built for.

If C++ could do what C can, then why is the Linux kernel 98.5% C code? Wouldn’t it be better to use a more varied and powerful language?

Or, maybe different languages have different use cases and cannot be directly slotted in to replace one another.

Re: Switching to C over 'Modern' Programming Languages

#99

Earlier quoted context omitted.

> when everyone was coding assembly.. This was before my time, but I think it's a common misconception (only true for operating system development). When C was created, there was already Lisp, Cobol, Fortran, Algol, Simula, BASIC... and SmallTalk and Prolog were just around the corner - and most of those are much higher level than C).

I think parent knows. A more accurate description would be everyone of the intended audience was writing assembly. Yes there are other languages of higher levels, but C was not invented to help their users. And since they are also not really what Rust targets either, IMO it’s reasonable to shorten it to drop the qualifier in this context.

[flagged]

Re: Switching to C over 'Modern' Programming Languages

#100

Earlier quoted context omitted.

This is my main reason for not thinking that rust is good for games - a quick prototype / test / reject approach is important

Don't games work by an engine which doesn't have a lot of rando changing user facing features, that could be rust. And the engine provides a dsl that is the high level user facing rapid change thing?

Yeah, Rust may be a good choice for a game engine, but at the same time not a good choice for the actual game code.
Post reply on HN