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

For me 2022 was the year of learning C++ (background in C# and Php) and I must say that after being intimidated by the language (extensive use of pointers, stack/heap compile/run time allocation and deallocation, templates) for years, when I really took a proper look and got some practice, it is an incredible language. The command an control you get by working with memory and the system on a lower level is amazing. I found it so much easier to learn (once I got the grasp of the cpp way of doing things) than something like Rust. All the higher level advanced concepts work and flow beautifully as you'd expect based on the lower level of the language... and the amount of "magic" is kept to minimum... you can just open std and look at what is being done and it all males sense. I understand why people want to move from C++ but as a newbie in this language, I find it amazing.


It's all sunny until valgrind / asan fail to reveal the source of an elusive "Uninitialised value was created by a stack allocation"


I work on a C++ project and actually sympathise with this sentiment. It's a massive strategic risk to our org, we pay a consistent tax in reduced productivity and stupid bugs, and I will advocate migrating away as soon as we have a suitable destination (Carbon looks promising).

But, I do also really enjoy writing C++! I'm optimistic that writing Carbon/Val/whatever ends up gaining traction in the industry will be just as good though.


Are you using legacy C++ or modern C++?


Quite modern! A few of the latest features we don't use yet but overall it's pretty up-to-date. Also no exceptions.


> I find it amazing.

This shall pass :)

The main beef with C++ is that it's just a mass of every single feature possible held together with some goo. It works, but there's no grace and elegance.


It is really only the fact that everyone writes C++ a little bit differently. From the outside this looks like C++ is a mess, but in reality, you can pick and choose what you like, and that's exactly what people do. You can be as safe or as unsafe as you need to be. That, of course, also opens the door for beginners to accidentally write unsafe code for a long time before they know all the footguns.

I think the real dent in C++ comes from wholesale improvements to languages by adding package management, one-liner built-in toolchains, built-in testing and build system. I could write paragraphs about why this is a good thing but we all know why.

CMake is making an effort in making it easy to fetch content for your build system, including Git repos, so there are paths to take today, but you need to learn a lot of separate things just to get started with C++. What are the chances that a beginners C++ tutorial gives you all the best practices in a way that a newer language does by default?

Learning C++ will probably look like the experience of using a web server with poor defaults, a strange configuration language, and thousands of different tutorials detailing a 20-year period of changes.

If I were to host content today I would not use Apache or nginx - I would probably start with Caddy and go from there.


> improvements to languages by adding package management, one-liner built-in toolchains, built-in testing and build system. I could write paragraphs about why this is a good thing but we all know why.

Not everybody shares this sentiment. I think it's great to be able to get yourself up and running quickly, and start dabbling with the language immediately, but I also think that at the same it is not so great because there is no "one size fits all purpose". I, for instance, happen to value the latter more than the former.


FWIW, I also wrote a lot of C++ for the first time last year, and found the lack of

> package management, one-liner built-in toolchains, built-in testing and build system

To be by far the least pleasant things about the language, especially C++20 where things like concepts are wonderful to use, but then you can't rely on having a toolchain that actually supports it. The most recent xcode/Apple Clang do not, so on Mac you need to find your lib(std)c++ elsewhere.

It'd be great if there were at least some way to make this easy, e.g. to create a virtual environment that sets all paths correctly. Or if the compiler from a toolchain would default to using its own headers and libraries instead of defaulting to the system's. (I assume they don't for a combination of historical reasons, and that you'd then you may be unable to link to system libraries due to things like mismatched std libraries).

Preferably, there would also be a GitHub Action to do it to make CI easier to set up.


> but then you can't rely on having a toolchain that actually supports it.

C++20 is still a bleeding edge so I'd advise you to pick C++17 or even C++14 if you want to have pleasant cross-platform coverage. That's what most companies with the goal of true cross-platform support will do. 3-year window time for compiler and library devs is really hard, especially given how many new features were introduced to C++20. And now consider how many different vendors there are ... https://en.cppreference.com/w/cpp/compiler_support numers them 12 but it doesn't count the ones from embedded space for example and probably some other are missing too, so 20? What we want to see on the paper hardly can match the much more complex reality.

> The most recent xcode/Apple Clang do not

It's a PITA, as usually found with Apple, especially considering that all other major compilers including GCC, Clang, MSVC and ICC work just fine: https://godbolt.org/z/Mj6ehq57v

> so on Mac you need to find your lib(std)c++ elsewhere.

This wouldn't work because concepts aren't a library feature but a compiler feature so perhaps your best bet would be to see if you can use vanilla clang or GCC to compile the code on Apple machines. I am not an expert here.


Generally it is the people coming from C or C++98 who write unsafe code. People picking up C++20 start out using it safely, and continue.


While C++ is the one with more features, the same can be said about Java 20, Python 3.11, C# 11, Haskell 2021,... when comparing against their version 1.0.


The problem of C++ is that its features are not just additive. In most languages, if you take two features and use them both, they add up. In C++, they may actively interfere with one another.


I gather you don't have much use of the latest versions of the languages I mentioned, in all of them I can think of examples that don't add up.


I’d be curious which Python features don’t work together?


One example sorted out with Python 3 would be old style classes and new style ones.

Other would be tracking down if attributes get dynamically changed via __dict__, __slots__, and how __slots__ interact with each other if multiple definitions happen to exist.

The way numeric division and remainder changed between Python 2 and 3.


I think you’re talking about a different issue here.

The person you replied to previously was talking about how certain new C++ features don’t work together. For example move with a lambda can cause UB.

You’re talking about changes to the language or if you have a conflict of definition.


All of that are changes/features regardless of which form they take.


No.

They’re talking about feature incompatibility within a single version.

You’re talking about feature differences between different versions.

Completely different things.


> In most languages, if you take two features and use them both, they add up.

Java nio vs. io

Java Reader vs. InputStream (not necessarily the interfaces themselves, but the redundancy between them eg should I use InputStream -> BufferInputStream -> InputStreamReader? Or InputStream -> InputStreamReader -> BufferedReader?)

Java float[] vs. ArrayList<Float> vs Vector<Float> vs. FloatVector vs. FloatBuffer - just how many ways can we describe "a linear allocation of numbers" in Java at this point? And they're still adding new ones!

So no, other languages don't just magically handle this more gracefully than C++ does. If a language is successful, it will either suffer from this or it'll stagnate - it's the natural consequence of preserving backwards compatibility while adding new features & capabilities.


Reader is for text/characters while InputStream is for bytes. An InputStream always lays at the heart of a Reader. Java's I/O may not be the most elegant of simplest, but it makes additive sense assuming you don't just have a bone to pick with the language.

The float examples are artifacts of pragmatism between plain old data types versus heap allocated objects. Though I do admit Vector<Float> is absolutely obsolete and should be avoided. The others have a clear purpose and raison d'être.

Now java.util.Date on the other hand…


> The others have a clear purpose and raison d'être.

Yes, but they don't compose cleanly together. As in, I can't just use FloatVector in all places that took a FloatBuffer previously or whatever. They aren't additive in an incremental migration sense, they are additive in the "these are just wholly unrelated APIs in their own wholly distinct silos" sense. Aka, the thing C++ is regularly slammed for doing even though it's additions aren't even this clunky.


Don't forget Date/Time classes. Absolute mess.


Something that .NET also missed to fix.


I doubt you can present even just a single example. All languages' features combine multiplicatively.


The rule of 0/3/5 literally exists because the default behaviours misinteract with any override of the rest.


Yeah, that doesn't qualify. It is all one feature: override copy or move semantics, and there is a prescribed way to do it. Rule of zero, of course, is the norm, and is an extremely beneficial interaction.

2nd try?


> Yeah, that doesn't qualify.

It absolutely does.

> It is all one feature: override copy or move semantics, and there is a prescribed way to do it.

And yet rather than force you to do it the language just goes into the weed and generates complete nonsense.


C++ gets special treatment for some reason when it comes to backwards compatibility and modern language features.

Oh no! we got threads and timers! C++ recognized the existence of file systems and regular expressions, woe I say! Polymorphic lambdas? I've got std::bind1st haha! Wait, not atomic! Anything but that!


Yes, but I think this is the ultimate fate of most successful languages. New languages start small and elegant, and everyone raves over them, then over time new features get added, and added ... and eventually the elegance and othogonality disappear. If this was a program rather than a language, now would be the time to refactor, but you can't because of backwards compatibility, so eventually you get to c++-like bloat. I actually like c++ -, but it's definitely out of control at this point.. although many people just ignore the bleeding edge features and basically code in something closer to c++11.

Languages really need to evolve to stay alive, but the evolution will eventually kill them!


... are there really people who go into their office job and think "oh this tool I'm using needs more grace or elegance?". If I had a carpentry company and my employees complained that their hammers and nails weren't elegant enough... I'd quickly look for new employees.


I agree. It is honestly a fine language IMO and while I have nothing against Rust, I also haven’t had much of an interest or incentive to use it. Yes, buffer overflow is a thing - it’s never been an issue in my experience. Use after free and memory leaks are infrequent, easy to fix, and caught early.

Golang is not a real replacement because 1. Golang core devs are too opinionated on random shit and make some things very hard to do without reinventing the wheel because “you shouldn’t do that” partially because it’s a corporate-owned language 2. GC. There are other minor things but those are the big ones, it’s still an excellent backend language but can’t replace C++.

Besides Rust everything else is a toy without stability and backwards compatibility and/or lack of libraries. Rust is fine, it’s just that the problems it tries to solve aren’t something that experienced C++ devs often struggle with.


> Besides Rust everything else is a toy without stability and backwards compatibility and/or lack of libraries. Rust is fine, it’s just that the problems it tries to solve aren’t something that experienced C++ devs often struggle with.

The single main reason for Rust's success is that this statement was proven wrong again, again and again. C/C++ devs kept repeating it, severe bugs keep getting discovered.


Yep, I totally agree. I took a long break from C++ after I learned the basics at university. I got into it again one and a half years ago when I needed really fast code and I was pleasantly surprised how easy it is. I'm exclusively using smartpointers and I very rarely run into scenarios where I have problems with memory leakage, etc.

Since I had written the prototype in Java and now interface with Javascript/Typescript, I'm really amazed how clean and well-reasoned my C++ side of the program is. So yeah, I'm also really happy with the state C++ is in right now.


Why was this comment flagged? C++ haters... really?


It doesn't deserve a flag, but the sunny optimism feels delusional. It's obvious that C++ has problems and there's obvious red flags like why someone like Linux Torvalds vehemently hates the entire language.

The poster addresses none of this and has a overly positive attitude towards C++. There's obvious nuance on this topic that the post fails to address and he instead just preaches to a biased choir. At least he admits he's a beginner.


[flagged]


All the Rust programmers I know are really happy to discuss the limitations and shortcomings of the language. It's possible that the problem you're pointing at comes from the word "reddit" rather than "rust" :)

Note: I've looked at the parent's comment history. The only one of them which was not a troll against Rust was a troll against the EU.

I'll stop feeding the troll.


[flagged]


Nobody is “getting personal” on this thread.


We use rust full time at my job, and griping about the language’s rough edges is a common pastime. The fanboys are loud and obnoxious but I can assure you they don’t make up the whole rust community.


Rust has its rough edges, but what people do is gripe about those in language development spaces. Then the rough edges get filed down in the next release trains, or sometimes the next language edition. In C++ they are totally unfixable.


> All the higher level advanced concepts work and flow beautifully as you'd expect

Are we talking about the same language? C++?


Also started learning C++ last year. Can concur.


What resources were you using to learn C++ that made "All the higher level advanced concepts work and flow beautifully"?


A tour of C++, third edition.


Elon is Elon. If he was too interested in other people's opinions, he wouldn't be where he is. That applies basically to all successful CEOs. Nonetheless he currently has a Teitter poll up if he should step down as a head of Twitter (and the majority voted Yes) and says he will do it if yes wins. Soooo...


>>That applies basically to all successful CEOs.

Worth remembering that it also applies to all(or most) unsuccessful CEOs too, and there are a lot more of those.

>>Nonetheless he currently has a Teitter poll up if he should step down as a head of Twitter (and the majority voted Yes) and says he will do it if yes wins

I personally hope the poll votes NO, purely to make him stick with it and continue this circus for a while longer without an easy excuse of "the poll voted yes so I'm resigning". I'm seeing plenty of articles already claiming he will appoint a new CEO within the next 24 hours though.


First, click polls are garbage and alllllways have been, second, he runs the platform with no dissent the poll will say whatever he wants it to say.


So when Elon steps down you'll apologize for confidently claiming that Elon manipulates his polls?


That's implying that the doesn't want the poll to vote yes, and I don't think that's true. There are already journalists claiming that he has a new CEO in mind and was going to step down within the next day or two because of how much shitshow this is - a twitter poll is a perfect easy excuse "hey guys I really didn't want to step down but you voted yes so I'm doing it, look how great and honest I am, keeping my word".


Yes I know, but that's why the comment above was so bad. Claiming that "it's all rigged anyway" with no proof is not a useful way to add to a discussion. You can make such a comment on every single topic. Just claim it's rigged because who knows, you don't like the person or you think he's bad or you have a gut feeling you want to share.


It doesn't matter if the polls are "rigged" as the demographic of "currently active Twitter users who follow @elonmusk" is not a representative sampling of all Twitter users. Many people who dislike him have him blocked, people who follow him most likely agree with him at least to some extent.

Note how when he suspended various journalists for posting screenshots of the Elonjet account after he changed the ToS on a whim, he first posted a 5 minute poll asking when they should be unsuspended with "now" being the result with the most votes, then deleted it and redid it with a 24 hour duration and just the options "now" (effectively meaning "tomorrow" as it would not be acted upon before the 24 hours were up) and "in 7 days". The poll again ended with "now" winning (by an even bigger margin). He obviously expected the original poll to go in his favor (after all, 5 minutes means it will mostly reach his direct followers and not have as much of a chance to exit his bubble). He even phrased the question in the most misleading way possible, referring to the accounts as having "doxxed my location in real-time" (again: this referred to posting screenshots with Elonjet's Mastodon account handle being visible).

Pretending this is in any way democratic or representative decision-making is absurd. Even when he reinstated various suspended far-right accounts (note that far-left accounts remain banned and he has since banned other far-left and even moderately left-wing accounts for less) he stated he would not reinstate Alex Jones for entirely personal reasons.

It doesn't matter if the polls are "rigged". They're not representative, they're not democratic and he doesn't care (nor is he legally required to). Calling them "rigged" is a distraction at best and normalizing the anti-democratic conspiracy theories about "rigged elections" at worst.


I don't think it's rigged at all. But I also think it's an extremely convenient excuse if it votes Yes - that's all.


Looks like we'll shortly be finding out https://www.bbc.co.uk/news/business-your-money-64021412

As a cynic, I agree with the anonymous quote in that article:

> "His investors are surely looking at this now and questioning whether he was the right horse to back. I imagine he's getting pressure from investors to step down and is using this poll to make it look like he's following the will of the people instead of the will of those paying his bills."


"Changpeng Zhao is thought to be one of Twitter's investors and said in May he had backed Mr Musk taking over by making a $500m investment."

I didn't see his name in the court documents. He must have been on the Tesla emails which coule not be used because of an undocumented Tesla policy giving Musks email special privacy rights.


The guy who slandered a rescuer as a pedophile because his nonsense idea of building a special submarine to rescue kids from a cave was snubbed is not "too interested in other people's opinions"?

The guy who claims degrees in fields that never existed at a university he never studied at is not "too interested in other people's opinions"?

The guy who made sure to add a clause in his separation agreement with PayPal that required PayPal to list him as a founder despite having made no meaningful contribution is not "too interested in other people's opinions"?

The guy who gave himself the title "Chief Engineer" at his own company SpaceX despite having no credentials or other qualifications in aerospace engineering is not "too interested in other people's opinions"?

The guy who replied to a random person's tweet about him being booed at a Dave Chapelle standup show to insist that it was actually 90% cheers and 10% boos except for the quiet parts, deleted that reply and then still insisted that he was only booed because the crowd consisted of woke SF leftists (who famously dislike Chapelle due to his recent history of mocking trans people) is not "too interested in other people's opinions"?

The guy who fired the entire communications department of Twitter so all requests for comment would have to go to him just like with his other companies is not "too interested in other people's opinions"?

The guy who slept on the factory floor at Tesla likely contributing nothing whatsoever by doing so is not "too interested in other people's opinions"?

The guy who became Twitter famous for pumping dogecoin, sharing other people's memes without attribution and trying to incorporate the numbers 420 and 69 into anything he can is not "too interested in other people's opinions"?

The guy who went through multiple chaotic rounds of layoffs after buying Twitter, regulations and local labor laws be damned, even going so far as to make the remaining employees virtually sign multiple "pledges" to do what he says is not "too interested in other people's opinions"?

I'm sorry to say, but based on his actions alone Elon Musk is one of the most insecure and fragile individuals on Earth and seeks constant reaffirmation by surrounding himself with yes-men and wielding whatever power he can get his hands on to shield himself from being subjected to any criticism.

But you're right in that he wouldn't be where he is if he were any different. His Twitter buyout literally started as a "meme" and blew up spectacularly because of his utter disregard for the law (or specifically in this case: contract law). He's used to get by by presenting himself as "real-life Tony Stark" and people are increasingly waking up to the fact that he actually is neither an actual engineer nor even remotely as business-savvy as everyone used to believe. Peter Thiel once called him a con artist and no matter what one may think about Thiel this description seems increasingly apt.


> Yes of course they need to know the law. Anyone who might potentially break the law during the course of their work needs to know what that law is.

Complete nonsense. This is criminal law. Google "Mens rea".


Stay civil.

This is not an argument against programmers, like other professionals, learning the aspects of the law which are relevant to their job. Why should programming be the one profession where this is not required?


Because to be criminally liable for something requires both a) actually doing something that is against the law and b) doing so with intent (i.e. you knew what you're doing is against the law and you did it anyway... because you thought you will not get caught or just didn't care). It is then up to the prosecution to prove, beyond reasonable doubt, that you actually intended to break the law. (With the exception of strict liability crimes, which are limited in scope to minor infractions and things like drunk driving or statutory rape.)

You can still get sued in civil court of course, but that's not the state trying to put you in a cage and so the standard goes from beyond reasonable doubt to most likely.

If you're a coder coding shady shit for your shady employer, you most likely know you're doing so and there's typically some trace or record left. But coders are not investment bankers and in fact may not even know anything about investment laws and regulations. And it's completely unreasonable to expect them to know. I worked on many projects, including medical and education... if I had to question and investigate every executive decision impacting my work then I wouldn't get anything done.


"Mens rea" is a requirement for certain crimes, but not all, you definitely can be criminally liable for doing something without intent. The trivial example is murder vs manslaughter, the latter does not require intent but obviously can be and is criminally prosecuted.

Furthermore, even in cases where mens rea is required, it gets satisfied if you intended to achieve the prohibited result even if you thought that the result was permitted. "Intent" is not about intent to break the law, it's about the intent to do the thing that happens to be illegal. In this case, it matters if you knew what the thing you're making was going to be used for (e.g. hide some stuff from auditors) but your knowledge or ignorance of the relevant laws and regulations doesn't matter at all - as another poster noted, https://en.wikipedia.org/wiki/Ignorantia_juris_non_excusat .


Sorry but this is completely wrong. “Mens rea” means knowing you were doing a particular thing. It doesn’t mean knowing that it was illegal.

E.g. if I take your wallet off of a table because I thought it was mine, I’m probably not guilty of theft. If I took it because I didn’t know theft was illegal, I probably still am.


It's the classic HN scraping butthurt. You can only do this if you're a billion (trillion?) dollar company and you do it behind closed doors.

All these concern trolls are bad actors. All of them.

Unless you literally steal someone's work and use it / sell it as your own, all the data mining is moral and should be legal if it isn't already.


> Unless you literally steal someone’s work and use it / sell it as your own

Artists creating work are not releasing it on the internet with ShareAlike licenses or any other license which openly allows derivative work or further distribution without a license. This is literally providing a means to stealing people’s work.

How is this any different from providing a listing of copyrighted movies and games and a means to download them, a la The Pirate Bay?


Jesus, the Apple fanboys truly are a different breed. E2E encrypted backups are nice, great even, but the rest of your post and especially the last paragraph are cringe worthy.


Lets be honest here: The name is FUCKING IDIOTIC. Every time I write "jupwhatever notebook" I want to ... break things.


I find it relatively easy to remember, while also helping narrow down search results from most search engines.


right, I kinda wish more languages did things like this. Every JS framework or library has a cute name but then realizes they need to always say the ".js" if they ever want any SEO results (looking at you Next. Node isn't much better either tho).

It might be silly, but if we just added some l33tspeak like n3xt or n0d3 we would actually be making out lives a lot easier. Or we could just spend like a whole extra minute to come up with something like Deno which is short and sweet and apparently unique enough to never conflict with other results


  alias nb=“jupyter notebook”


This is a problem that needs to be addressed. Needless suffering is always bad. But. Is this really a BIG problem or are the politics (of Elon being who he is) leaking again?

This is not about some social networking platform or a car company. If this thing works and eventually has the ability to vastly improve QOL of disabled people, won't the testing be justified? I mean... how many desd animals outweigh one functioning quadriplegic? Only extremists would say "zero" or "any number", but regular people will probably say a number in the hundreds. We're team people after all. Not to mention that we already kill millions of animals for food (most of which live in terrible conditions all their lives and some of which die in brutal ways). And it's not like Elon goes around killing endangered species, these are mostly sheep, pigs and rodents we're talking about here.


Before you get to that question, you'd want to first answer the question of whether the deaths of the animals were actually necessary to make progress in the first place. Just because Neuralink has killed 1500 animals doesn't automatically mean that those deaths were productive. They just as well could have been the result of negligence or recklessness without real scientific value. That seems like a question that's worth investigating.


> Like bro, you want to do stuff with “diffusion models”? You don’t even know how to add two normal distributions together! You ain’t diffusing shit!

Made me LOL. First time I did that while reading a tech post/blog in years. Also neatly describes half the HN audience fawning over the latest AI thing.


HN is a funny place. Each time one of these billion (or trillion) dollar scumbag companies does something scumbaggy, people come out of the woodwork and wish there was an alternative frontend. Twitter, Instagram, Youtube, Facebook... it has happened before and it will happen again. YET there's a A LOT of people here who get incredibly butthurt as soon as you mention the crazy idea of public website crawling being explicitly encoded into law as allowed. The only entities that would be hurt by this would be these fucking evil corps who abuse and evade the law all the time and are conspiring to extract as much money from the population as they can in countless shady ways.


Not to be THAT guy, but Physx is basically reaching EOL. I'm sure a few mid sized studios who want to roll their own engine can still take advantage of the core, but with UE5 completely replacing Physx with Chaos and the "ballast" around the core (Blast/Flex...) being as useless as ever, I don't see the Physx adoption increasing.


I believe NVidia develops PhysX mostly for robotic/metaverse simulation, not for games.

See positioning of NVidia Omniverse for example.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: