14 ms·
I compile a lot of C++ code from a lot of places, and the only time I run into code that somehow simply doesn't work on newer versions of C++ and where the deve
by saurik 2y ago
I compile a lot of C++ code from a lot of places, and the only time I run into code that somehow simply doesn't work on newer versions of C++ and where the developers aren't even sure if they will accept any patches to fix the issue as they claim it "isn't supported" to use a newer version of C++--even for the public headers of a library--is, you guessed it: code from Google.
Meanwhile, most of the C++ code from Google seems to be written in some mishmash of different ideas, always at some halfway point along a migration between something ancient and something passable... but never anything I would ever dare to call "modern", and thereby tends to be riddled with state machines and manual weak pointers that lead to memory corruption.
So... I really am not sure I buy the entire premise of this article? Honestly, I am extremely glad that Google is finally leaving the ecosystem, as I generally do not enjoy it when Google engineers try to force their ridiculous use cases down peoples' throats, as they seem to believe they simply know better than everyone else how to develop software.
Like... I honestly feel bad for the Rust people, as I do not think the increasing attention they are going to get from Google is going to be at all positive for that ecosystem, any more than I think the massive pressure Google has exerted on the web has been positive or any more than the pressure Google even exerted on Python was positive (not that Python caved to much of it, but the pressure was on and the fact that Python refused to play ball with Google was in no small part what caused Go to exist at all).
(FWIW, I do miss Microsoft's being in the space, but they honestly left years ago -- Herb's existence until recent being kind of a token consideration -- as they have been trying to figure out a tactical exit to C++ ever since Visual J++ and, arguably, Visual Basic, having largely managed to pivot to C# and TypeScript for SDKs long ago. That said... Sun kicking Microsoft out of Java might have been really smart, despite the ramifications?)
- groos 2y agoWhatever gave you the idea Microsoft "left" C++ years ago? It has massive code bases in C++ and continues to invest in its compiler teams and actively tracks the C++ standard. It was the first compiler to implement C++20 mostly completely, including modules, which other compilers have yet to catch up to. Like other mature companies, Microsoft realized decades ago that they can be a one-tech-dependent company and hence has code in C++ and .NET, and is now exploring Rust.
- mananaysiempre 2y agoCppwinrt is in maintenance mode[1]. Cppwin32 is abandoned (with windows.h as the official alternative). It is now possible to deploy WinUI 3 apps as single files in C#[2] but not in C++. From experience, the entire C++ side of WinUI 3 documentation is underbaked to the extent that the easiest approach is to read the C# documentation and attempt to guess the cppwinrt equivalent (as docs for cppwinrt are not really... there). I don’t know if they’ve really abandoned C++ entirely—the compiler team certainly hasn’t, that’s true. But the above doesn’t feel like first-class support. [1] https://github.com/microsoft/cppwinrt/issues/1289#issuecomment-1481303844 https://github.com/microsoft/cppwinrt/issues/1289#issuecomme... [2] https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview https://learn.microsoft.com/en-us/dotnet/core/deploying/sing...
- pjc50 2y agoWinUI3 itself feels kind of abandoned. Heck, everything except desktop OS (which changes we neither need nor want) and cloud (where everyone has gone) feels a bit neglected. C#/dotnet continues nicely, but the team is surprisingly small if you look closely.
- shortrounddev2 2y agoMicrosoft doesn't commit to UI frameworks in any language. By contrast, DirectX 11 and 12 (and Direct2D) are C++-native and have become core modules within NT. I don't think MS has abandoned C++, but the use case for C++ has shrunk considerably since the 1990s
- pjmlp 2y agoIf you go into Visual C++ developer blog, you will notice it has been all about Unreal support during the last year, and not much else.
- pjmlp 2y agoBesides the sibling comments, officially Windows is going to go under some rewrites under the Secure Future Initiative, and the MSVC team has been reduced in resources, to the point now they are asking what features of C++23 people want to have. https://developercommunity.visualstudio.com/t/Implement-C23-Standard-features-in-MSV/10777419 https://developercommunity.visualstudio.com/t/Implement-C23-... I suppose usually one would like to have everything from a language standard. The C++20 winning run seems to have been one of a kind, and whatever made it possible is now gone. Speaking of gone, Herb Sutter has left Microsoft and most certainly had to do something with whatever is going on MSVC, C# improvements for low level coding, and Rust adoption.
- WalterBright 2y agoBeing smart, well-educated, and knowing how to program isn't good enough for creating great code. It takes experience. I've been programming for 50 years now, and keep finding ways to make code more readable and more maintainable.
- ozim 2y agoHow do you find gimmicks from Bob Martin like (d + e*g) which in theory are great but to use it in practice would take loads of coaching?
- WalterBright 2y agoI'm not familiar with that gimmick. One thing I learned, for example, is do not access global immutable state from within a function. All inputs come through the parameters, all outputs through the parameters or the return value.
- ozim 2y agoCool I am just confirming my own bias against much of „clean code” teachings. That it might be a bit easier to read order of the operations - but no one uses it so it doesn’t matter.
- WalterBright 2y agoThere are lots of things that look like great methods, but experience with them often leads to disillusionment. For another example, Hungarian notation is a really great idea, heavily adopted by Microsoft Windows, and just does not deliver on its promises. For example, types can have long names, but that doesn't work with HN. Changing a declaration to have a different type then means you've got endless cascading identifiers that need to be redone. And so on.
- zozbot234 2y ago> Changing a declaration to have a different type then means you've got endless cascading identifiers that need to be redone. This is actually a good thing, every mention of that identifier is a place that you might need to adapt for the new type. Hungarian notation is an excellent coping mechanism when you have to use compilers that don't do their own type checking - which used to be a huge issue when Hungarian notation was current.
- myworkinisgood 2y agoMicrosoft has been net negative to the ecosystem as well.
- throwaway2037 2y ago> riddled with state machines Why is this bad? Normally, state machines are easy to reason about.
- lmm 2y agoI've never understood this claim. I find state machines very hard to follow because there's no easy way to tell what paths lead to a given state; they're like using goto instead of functions (indeed they're often implemented that way).
- AnimalMuppet 2y agoThey can be. Or they can be... less easy. Imagine you have an informally-specified, undocumented, at-least-somewhat-incomplete state machine. Imagine that it interacts with several other similar state machines. Still easy to reason about? Now add multithreading. Still easy? Now add locking. Still easy? Cleanly-done state machines can be the cleanest way to describe a problem, and the simplest way to implement it. But badly-done state machines can be a total mess. Alas, I think that the last time I waded in such waters, what I left behind was pretty much on the "mess" side of the scale. It worked, it worked mostly solidly, and it did so for more than a decade. But it was still rather messy.
- pjc50 2y ago> Now add multithreading. Still easy? > Now add locking. Still easy? Don't do that then. Or rather, either manipulate the state machine from only a single thread at a time; or explicitly turn the multithreading into more states. If you need to wait for something instead of having "do X" you transition into state "doing X". C#-style async does this in a state machine behind the scenes.
- rramadass 2y agoBut that is just true of any problem-solving/programming technique. In general, state/event machine transition table and decision table techniques of structuring code are easier to comprehend than adhoc and even worse, poorly understood pattern-based techniques are.
- vinkelhake 2y ago> Honestly, I am extremely glad that Google is finally leaving the ecosystem, as I generally do not enjoy it when Google engineers try to force their ridiculous use cases down peoples' throats, as they seem to believe they simply know better than everyone else how to develop software. Well, you may be celebrating a bit prematurely then. Google still has a ton of C++ and they haven't stopped writing it. It's going to take ~forever until Google has left the C++ ecosystem. What did happen was that Google majorly scaled down their efforts in the committee. When it comes to the current schism on how to improve the safety of C++ there are largely two factions: * The Bjarne/Herb [1] side that focuses on minimal changes to the code. The idea here is to add different profiles to the language and then [draw the rest of the fucking owl]. The big issue here is that it's entirely unclear on how they will achieve temporal and spatial memory safety. * The other side is represented by Sean Baxter and his work on Safe C++. This is basically a whole-sale adoption of Rust's semantics. The big issue here is that it's effectively introducing a new language that isn't C++. Google decided to pursue Carbon and isn't a major playing in either of the above efforts. Last time I checked, that language is not not meant to be memory safe. [1] https://github.com/BjarneStroustrup/profiles https://github.com/BjarneStroustrup/profiles [2] https://safecpp.org/draft.html https://safecpp.org/draft.html
- pjmlp 2y agoPeople like to always talk about Carbon like that, yet the team is the first to point out anyone that can use something else, should. Carbon is an experiment, that they aren't sure how it is going to work out in first place. > "If you can use Rust, ignore Carbon" https://github.com/carbon-language/carbon-lang/blob/e09bf82d364d8efb70edb55213b31d7260d8fe4f/docs/project/faq.md#if-you-can-use-rust-ignore-carbon https://github.com/carbon-language/carbon-lang/blob/e09bf82d... > "We want to better understand whether we can build a language that meets our successor language criteria, and whether the resulting language can gather a critical mass of interest within the larger C++ industry and communit" https://github.com/carbon-language/carbon-lang/blob/e09bf82d364d8efb70edb55213b31d7260d8fe4f/README.md#project-status https://github.com/carbon-language/carbon-lang/blob/e09bf82d...
- IAmLiterallyAB 2y ago> Herb side that proposes minimal changes Herb is developing a whole second syntax, I wouldn't call that minimal changes. And probably the only way to evolve the language at this point, because like you said Sean is introducing a different language entirely, so its not C++ at that point. I really like some of Herb's ideas,but it seems less and less likely they'll ever be added to C++
- returningfory2 2y agoI think the article is pretty interesting. There are so many more interesting takes than just another boring Hacker News moan about Google.
- pjmlp 2y agoThe issue with Microsoft until recently, has been the power of WinDev, which are the ones responsible for anything C++ on Microsoft dungeons. Hence the failure of Longhorn, or any attempt coming out from Microsoft Research. Ironically, given your Sun remark, Microsoft is back into the Java game, having their own distribution of OpenJDK, and Java is usually the only ecosystem that has day one parity with anything Azure puts out as .NET SDK.
- quietbritishjim 2y agoWhat is "WinDev"? A quick search didn't turn up much except a French Wikipedia article.
- pjmlp 2y agoWindows Development, per opposition to DevDiv, Developer Division. Two quite common names in the Microsoft ecosystem.
- loup-vaillant 2y agoFor a moment there I thought you were referring to this trademark: https://pcsoft.fr/windev/index.html https://pcsoft.fr/windev/index.html Which was known at a time for having young women in light clothing in their marketing material.
- jcelerier 2y agoaha, that's the windev that comes to mind too. I didn't know they were actually a french company, wild that they're still around... their ads were plastered everywere in the 2000s. Apparently they have a programming language for which you can "one-click-switch" between english and french for the keywords??? https://pcsoft.fr/windev/ebook/56/ https://pcsoft.fr/windev/ebook/56/
- voidfunc 2y agoThat's actually kind of neat, also I love how the brochure uses the American flag for English...
- pif 2y ago[flagged]
- pif 2y ago[flagged]
- zozbot234 2y agoGolang is a great programming language if your alternative is Java, C# or scripting languages like Python/Ruby/etc. Not everything needs to be written in C++ or Rust from the outset. It's also reasonably possible to rewrite small codebases from Golang to, e.g. Rust for better performance.
- guappa 2y agoIt really isn't, no. It joins an awkward syntax with bad API design and terrible safeguards.
- otabdeveloper4 2y agoDon't be so mean, it's definitely a step up from PHP.
- guappa 2y agoAnd then they were so unproficient that they made a terrible language that has the same amount of safeguards as C (ok a bit more, but not much more).
- deleted 2y ago[deleted]
- DanielHB 2y ago> code from Google. I spilled my coffee, I was just talking the other day to some coworkers how I don't trust google open source. Sure they open their code but they don't give a damn about contributions or making it easy for you to use the projects. I feel a lot of this sentiment extends to GCP as well. So many google projects are better than your average community one, but they never gain traction outside of google because it is just too damn hard to use them outside of google infra. The only Google project that seems to evade this rule that I know of is Go.
- badpun 2y agoTensorflow is/was decent. It looked like they made a lot of effort for it to be accessible for outsiders.
- th2oi34234234 2y agoHave you tried building the damn thing ? Nix build is still stuck in the one from 3-4 y back because bazel doesn't play well. Debian too has some issues building the thing...
- jimmaswell 2y agoAs an industry we need to stop treating breaking changes as an acceptable thing. The rate of bit rot has accelerated to an absurd pace. I can't remember the package but I had to spend considerable time fixing a build because a package.. changed names.. for NO REASON. They just liked the new name better. This should be career death. You're wasting your fellow humans' time and energy on your vanity when you make a breaking change that is at all avoidable. I should be able to run a build script made 20 years ago and it should just work. No renamed package hunting, no WARNING WARNING DEPRECATED REWRITE ALL YOUR CODE FOR LEFTPAD 10.3 IMMEDIATELY in the console, no code changes, no fuss, we should expect it to just work. This state of affairs is a stain on our industry.
- __MatrixMan__ 2y ago
- protomolecule 2y ago> riddled with state machines What's wrong with state machines? Beats the tangled mess of nested ifs and fors.
- bluGill 2y agoThat depends on your problem. I've seen useful state machines. I've seen someone implement a simple decoder as a complex any-to-any state machine that couldn't be understood - a single switch statement would have been better. Nothing about state machines, but some people have a hammer and are determined to prove it can drive any screw - it works but isn't how you should do it.
- garethrowlands 2y agoSwitch + goto is the classic way to implement a state machine in C.
- jimmaswell 2y agoI've adopted a rule of thumb to have a very low bar to skip straight to writing a state machine. I've never once regretted it, personally. I'm sure they can be misused but I haven't came across that.
- trmantrl 2y agoThe technical pressure exerted on Python (which was resisted) is one thing. The social pressure incubated the most radical culture warriors the Internet has ever seen and its proponents have ruined the Python organization, driven away many people and have established a totalitarian and oppressive regime. Interestingly, Google has fired the Python team this year. The revolution eats its own? Anyway, Rust should take note and be extremely careful.
- tialaramex 2y agoBased on what an ex-Google developer said in conversation at a party at the weekend (the discussion was about the choice of First Language for a Computer Science degree course, yes, I do go to exciting parties, many of those attending have never even been a CS lecturer): Some years ago Google decided that Go projects were similar engineering effort, better performance, lower maintenance, and so on that basis there was no reason to authorise new Python software and their existing projects would migrate as-and-when.
- andai 2y agoI am out of the loop, what kind of pressure were they putting on Python?
- shadowgovt 2y agoThis phenomenon is mostly because, as the article notes, Google has one of the largest C++ deployments in the world. And since much of the C++ code needs to be extremely platform-agnostic (any given library might be running in a web service, a piece of Chromium or Android, and an embedded smart home device), they tend to be very conservative about new features because their code always has to compile to the lowest-common-denominator (and, more importantly, they're very, very sensitive to performance regressions; the devil you know is always preferred to risking that the devil you don't know is slower, even if it could be faster). Google can embrace modern processes, but the language itself had better be compilable on whatever ancient version of gcc works on the one mission-critical architecture they can't upgrade yet...
- taneq 2y ago> I compile a lot of C++ code from a lot of places, and the only time I run into code that somehow simply doesn't work on newer versions of C++ I'm impressed that you even get as far as finding out whether that much C++ from disparate sources works on a newer version of C++. The myriad, often highly customized and correspondingly poorly documented build systems invented for each project, the maze of dependencies, the weird and conflicting source tree layouts and preprocessor tricks that many projects use... it's usually a pain in the neck to get a new library to even attempt to build, let alone integrate it successfully. Don't get me wrong, we use C++ and ship a product using it, and I occasionally have to integrate new libraries, but it's very much not something I look forward to.
- fpoling 2y agoI second the observation of the state of Google C++. Just look at Chromium. There are a lot of unfinished refactoring there, as if people lost interest the moment the clean refactoring hit a roadblock requiring efforts to communicate with other teams. Only by a sort of direct order from the management things can be completed.
- selfmodruntime 2y ago> Like... I honestly feel bad for the Rust people, as I do not think the increasing attention they are going to get from Google is going to be at all positive for that ecosystem We are just now feeling this. Some original contributors left the field, and lately the language has went in directions I don't agree with.
- nicce 2y agoBut Google is not even the first. Amazon has had their eyes in Rust for quite some time already.
- Conscat 2y agoAs an outsider, I'm curious what directions those are. Are you referring to effects or keyword generics or something else?
- selfmodruntime 2y agoEndless bikeshedding about `Pin` would be one example. I'm also not sure keyword generics are the correct way.
- zozbot234 2y agoThe discussions around 'Pin' are the opposite of bikeshedding. It's not about what color to pick for the shed, it's about reworking the feature to make it hopefully easier to reason about and use.
- cmrdporcupine 2y agoThe C++ from Google that people in the outside world are seeing is not the C++ the article is talking about. Chromium and open sourced libraries from Google are not the same as C++ in Google3. I worked on both back in the day and ... There's slightly different style guides (not hugely different), but most importantly the tooling is not the same. The kind of mass refactorings / cleanups / static analysis talked about in this article are done on a much more serious and large scale on C++ inside the Google3 monorepo than they are in Chromium. Different build systems, different code review tools, different development culture.
- deltaburnt 2y agoGoing from g3 to AOSP has been downright painful. It was like suddenly working in a different company the contrast was so stark.
- cmrdporcupine 2y agoInteresting. I never worked in Android, but did in Chromium & Chromecast code bases. Biggest difference with Google3 was honestly in the tooling. Style guide was fairly close, maybe a bit more conservative. Also the lack of the core libs that eventually became Abseil. I work full-time in Rust these days and everytime I go back to working in C++ it's a bit of a cringe. If I look long enough, I almost always find a use-after-free, even from extremely competent developers. Footgun language.