Hacker Newsnew | past | comments | ask | show | jobs | submit | torlok's commentslogin

Same thing was said about crypto.

I write mostly like I would in C, but use C++ features as needed. It ends up looking similar to Rust if you squint. All these "I write games in C" people complain about C++ features, and then end up reimplementing virtual interfaces manually with struct headers or massive switch statements, just to feel better about themselves. Writing games in C is not harder, you just have to implement modern language features by hand.

Complaining about a language having features you don't want is silly. C++ doesn't take longer to compile if you don't abuse templates.


> Complaining about a language having features you don't want is silly.

It might be silly if you're working on your own. Software that delivers a lot of value is usually developed and evolved not only by team, but by a team with changing members and changing leadership over the project's lifetime. The features used will be the union of all features used over the years, and while it's easy for team leads to allow the use of more features than their predecessors, it's quite hard to reduce them.

Also, you may be forced to use language features you don't want if they're used by libraries whose functionality you do want. For example, when doing low-level programming, I don't like implicit calls that I can't clearly see on the page (e.g. destructors or overloaded operators). But if libraries I want use them, then I'll have those implicit calls. But if the language doesn't have those features, libraries obviously won't use them.


> It might be silly if you're working on your own.

That's exactly the case when it's easiest. If you don't need a feature, just don't use it and case closed. With a team it's harder - you have to force/enforce others not to use a given feature.

> if they're used by libraries whose functionality you do want

If you're using C++ you can just use the C library you would've used otherwise, no?


There are linters to do that enforcement automatically.

> C++ doesn't take longer to compile if you don't abuse templates.

Surprisingly, this is not true. I've written a C++ file only to realize at the end that I did not use any C++ features. Renaming the file to .c halved the compilation time.


In fact, I don't believe you so much that I'm willing to say you're full of shit. No compiler capable of both C++ and C will be twice as fast renaming the file to C

I agree it shouldn't really matter if there's no C++ features in play, but I suppose third party headers could bite you if they use #ifdef __cplusplus to guard an optional C++ wrapper over their C interface. That code would completely disappear if you switched to C mode.

I don't believe you, I measured compile times in c compilers and my own. If you provide more information I'd be more likely to believe you

I remember the creator of Kaiju engine stating something about C++ compilers producing slower code with C-style C++.

I measured once and to my surprise templates aren't (directly) the reason for long compile times. It's function bodies in headers, and obviously templates are in headers and they call other templated functions/classes which explodes code generation and time. But if it's only a few lines and doesn't call other templated functions it's likely fine. I wrote about it here https://bolinlang.com/wheres-my-compile-time

After writing that, I wrote my own standard library (it has data structs like vector, hashmap and sets; slices, strings, rng, print, some io functions, and more) which uses a lot of templates, and it compiles in <200ms on both clang and gcc. Many standard library headers take much longer to compile than that. It's not a terrible idea to have your own standard lib if you need quick compile times.


Yeah, you could argue that choosing C is just choosing a particular subset of C++.

The main difference from choosing a different subset, e.g. “Google C++” (i.e. writing C++ according to the Google style guide), is that the compiler enforces that you stick to the subset.


C's string handling is so abominably terrible that sometimes all people really need is "C with std::string".

Oh, and smart pointers too.

And hash maps.

Vectors too while we're at it.

I think that's it.


I agree on the former two (std::string and smart pointers) because they can't be nicely implemented without some help from the language itself.

The latter two (hash maps and vectors), though, are just compound data types that can be built on top of standard C. All it would need is to agree on a new common library, more modern than the one designed in the 70s.


why not std::string?

C is not a subset of C++, there are some subtle things you can do in C that are not valid C++

Some subtle and some not so subtle.

I feel like, for me, it’s that I am more familiar with writing in C and switching to C++ seems rather difficult. So, sure I am reimplementing features that already exist in anoter language, it just so happens in this case is C++. Why not use python if you want to avoid reimplementing the wheel as much as possible. And sure python is not suited for game development but I just wanted to make a point with it. I think in the end ising a language you are most familiar with results in the most amount of enjoyable coding.

For a solo dev, it's not difficult. C++ is nearly a superset of C. You don't have to adopt all of C++ to start using it and to get immediate benefits from it (for example, unique_ptr, shared_ptr, and vector would all be things that I think any C dev would really appreciate).

A reason I can think of to not move to C++ is that it is a vast language and, if you are working on a team, it can be easy for team members ultimately forcing the whole team to become an expert in C++ simply because they all will be familiar with a different set of C++ features.

But for a solo dev? No reason not to use it, IMO. It's got a much nicer standard library with a rich set of datastructures that just make it easier to write correct code even if you keep a C style for everything.


I’ve seen this play out a lot. People say they “write games in C” and then quietly rebuild half of C++ anyway with vtables in structs or giant switch statements, just without the compiler helping. That’s fine if it makes you happier, but it’s not obviously simpler or safer. Also, C++ compile times are mostly a self-inflicted wound via templates and metaprogramming, not some inherent tax you pay for having virtual functions.

I think it is simpler and "the compiler not helping" == "things are more transparent".

  int a = 3;
  foo(a);
  // What value has a ?

There are various things one does not have to worry about when using C instead of C++. But the brain needs some time to get used to it.

A switch statement is how you do ad-hoc polymorphism in C -- i dont thinks an own against C developers to point that out. If they wanted to adopt the C++ style that immediately requires the entire machinery of OOP, which is an incredibly heavy price to avoid a few switch statements in the tiny number of places ad-hoc poly is actually needed

You don't usually do C++ subsets if you want the full shebang.

I have a "mini-std" headerfile that's about 500 LoC implementing lightweight variants of std::vector, std::function, a stack-local std::function (unsafe as hell and useful as hell to avoid allocations), a shared-ptr, qsort and some other nifty stuff.

That does a lot of things, but even then I use other patterns that brings a lot of bang for the buck without having to go full C (hint: the stack-local function equivalent gets a lot of mileage).


This reads like an LLM generated response that simply restates the comment it's replying to

Heck the LLM accusations get a bit out of hand lately here on HN. I could delve into it now ... but I want to safe our time.

It's important that you do these things yourself before you utilise the compiler to do them for you, so you have real understanding.

> but it’s not obviously simpler or safer

On top of likely having worse performance.


Exactly, not even do you need to religiously need stick to your subset, separate modules can be using supetsets that import useful libraries and if they're used for code that is seldomly changed (such as model importers) then the longer compile time will only matter for rebuilds and not quick tests.

It's possible to use only a subset of the language. You could write a Java program without classes if you really wanted to. Just put the whole thing in main().

A lot of smart people pick and choose what they want from the language, just like religion, they keep the good parts and discard the bad.


> just to feel better about themselves.

Mindread much?


>Writing games in C is not harder, you just have to implement modern language features by hand.

I feel like if you need to implement modern language features, you shouldn't be using C. The entire point of C is to not be modern.


It's in the Epstein files. Bannon was seeking funding from Epstein for all the worst far-right movements in Europe.

The point is that the data you're sharing may look banal to you now, but you have no idea how it might get used in the future, and by whom. You should assume that all data you share is available to everybody. Thus everybody should prefer privacy by default.

Caring about jetpacks, flying cars, or robot maids is such modern-day capitalist brain rot. George is the family's breadwinner and works only two days a week for one hour a day in the show.

It’s a show. The characters in Friends barely work at all and have huge manhattan apartments.

On Friends it's implicit, on The Jetsons is explicit.

>George is the family's breadwinner and works only two days a week for one hour a day in the show.

That really seems to go against the premise of the show as shown on the opening (typically modern day 1960s nuclear family but in the future).

I looked into this and Wikipedia cites this fact as being from the 1985 version not the original cartoon.

I suspect taking a joke about George's workday from the 85 version as "canon" kind of misses the point of the show.


Elon didn't want to get outshined after Sam Altman suggested that "maybe we build a big Dyson sphere around the solar system". When will people realize that these "geniuses" are only good at making money, and any benefit to society is coincidental.

There's an audience for this. People have been taking these vapid statements and his trouble with communicating as evidence of genius for well over a decade now.

Poland is still low on the EU ladder in terms of GDP per capita and PPP. What I wish is that the amount of subsidies from the EU was better communicated in the face of rising anti-EU sentiments, and the periodically-returning topic of WW2 reparations.

The voter base doesn't care. Federal agents are sent to a state against the governor's will, a man gets shot and killed while carrying a holstered pistol, and all the MAGA 2nd amendment republicans think this was a justified killing because he had a gun on him.

Their voter base - and not the rest of us.

There will be a reckoning - and it may originate from the most unexpected place.


When and where from?

The other side of the voters has happily expanded the power of the executive for decades while demonizing those who would put in some restraint. Both sides do this and here we are. The people voting against Trump still gave him power, just not while he was in office.

> Federal

> against the governor's will

that's kind of the idea


Can you elaborate?

A Federal intervention is generally not called for unless a State pointedly does not get with some Federal mandate or another. See desegregation in the South for another notable historic example.

Of the Little Rock 9 in Arkansas:

>When integration began on September 4, 1957, the Arkansas National Guard was called in to "preserve the peace". Originally at orders of the governor, they were meant to prevent the black students from entering due to claims that there was "imminent danger of tumult, riot and breach of peace" at the integration. However, President Eisenhower issued Executive order 10730,[18] which federalized the Arkansas National Guard and 1,000 soldiers from the US Army and ordered them to support the integration on September 23 of that year, after which they protected the African American students. The Arkansas National Guard would escort these nine black children inside the school as it became the students' daily routine that year.

Ideally though, this type of intervention should be exceedingly rare or reserved for the most egregious cases. Unfortunately, the present administration sees only the mechanism, and is motivated more by pettiness than any real commitment to Statecraft.


their voter base is drenched in lies and agitprop spewing 24/7 from the computer in their pockets

I thought he had freakishly large hands before, but that picture of him on the top with his hands in the air makes him look like the lawyer uncle from Always Sunny. He's built for free solo.

You need to be specific! There are 2 lawyers with completely opposite hand sizes.

The one educated in bird law.

touche.

I assumed they were talking about the uncle’s fake hands: https://m.youtube.com/watch?v=UWVVLKZ56zM&pp=0gcJCTMBo7VqN5t...

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: