4 ms·
>Why do people put up with this? What are we supposed to do, cancel our subscription to C++? Complain to the CEO of C++?
by sevagh 3y ago
>Why do people put up with this?
What are we supposed to do, cancel our subscription to C++? Complain to the CEO of C++?
- wruza 3y agoToday you just cancel it on twitter, afaik. May also shoot a series of tiktoks.
- bruce343434 3y agoI speak as someone who was somewhat intrigued by the allure of C++, but then turned off by its complexity (as in, feeling anxious about the code I write because I have no idea what silent footguns I might be triggering now). When not writing in interpreted web tech langs for my dayjob, I tend to use Rust and C. I've also heard good things about Zig and Nim. What I'm genuinely interested in, is why is this such a big deal for me, but apparently not for other people? What copes do people employ to get over it to enable themselves to write C++? Per my initial question: why (and how) do people put up with it? Especially when modern and powerful alternatives exist which have mostly either learned from the mistakes of C++, or avoided them altogether.
- sevagh 3y agoSpeaking for myself: 1. I use a small amount of the surface area of C++, so the parts I don't use don't bother me 2. I may have silent footguns all over my code, but if I run my CMake build, and the tests pass, and the application does what I need from it, I really don't care 3. The up-front cost of writing correct/no-footgun code using Rust (as just one example) for me is much worse than the fluid "anything goes" of C++ >What copes do people employ to get over it to enable themselves to write C++? C++ is powerful, flexible, and ubiquitous. Many third-party libaries in my daily toolbox are in C++, and I can re-use my code on Android, WebAssembly, cli applications, and any kind of project I may need to deploy. C++ skills are more widely available, such that maintaining C++ code is easier for companies (hiring employees, contractors, etc.) Delivering C++ code has me access to more clients and projects. I can finish a C++ audio project for a client faster than I can figure out a `Ref<Arc<&'a static mut`, and they're happier for it.
- googh 3y agoThe thing is, these problems rarely arise for programmers who daily code in C++. People who don't use C++ love to enumerate different C++ gotchas. In reality, most C++ projects define a coding style that dodges most of these problems. For instance, I don't use default arguments at all. That said, I don't start new projects in C++ mainly because of the header/source split. After writing a lot of code in languages that don't require a header file, I believe that C/C++ not making headers files redundant in 90s itself has been a costly mistake. Think of the time wasted because of constantly having to sync header/source files. One can argue that it does not take much time but it is hard to estimate how many bugs might be introduced because of such busywork breaking mental flow. Oddly, real problems like these are never brought in these "C++ sucks" discussions.
- bruce343434 3y agoOh yeah, the header thing drives me insane as well. People put up with the stupidest shit. I try to structure my code to only ever include actual .c files, so that there's no need for .h files. (Learned to do this writing "raw" php in the past... I guess I put up with that because it was my income). Doesn't scale past a certain point sadly.
- hyperhopper 3y agoStop using c++ in new projects.
- sitzkrieg 3y agostop prescribing bad advice
- hyperhopper 2y agoThey asked a question, and I gave an answer that is in line with the guidance from many senior engineers with a wide variety of language experience, and many governmental and security organization's advice. The reason to use c++ is for low level performance, but it's not 2005, you can now get the same performance with modern languages that give increased safety, developer velocity, readability, maintainability, and more.