Live data from Hacker News

I learnt C++ in 2018 and have no regrets

vishnubharathi.codes

151–160 of 259 posts

Re: I learnt C++ in 2018 and have no regrets

#151
post #103
post #70

Earlier quoted context omitted.

Examples? As a maven advocate I've commonly seen this claimed ("we have to have an ant build because we need to do x/y/z custom thing") but I've never seen an example that held up under scrutiny. E.g. there's no reason any project would ever need a custom source directory layout. No project needs to run tests before compile (and if you really need build step x to happen before build step y, you can always separate th…

Because legacy. Maybe one can't reorganise the source tree layout because to do so would break our custom tooling / integration systems / interface with proprietary vendor tools. We can't change version numbering schemes because our packages already exist 'in the wild' and can't be changed mid-sequence without causing both technical and user pain. Fundamentally: the codebase has worked perfectly well this way for the…

> Because legacy

Yes. And there are codebases that are going to outlive thee shiny tool of the month (or the decade, even).

Re: I learnt C++ in 2018 and have no regrets

#152
post #86

Earlier quoted context omitted.

Nonsense. C++'s template system behaves unlike any other language (things like SFINAE and the techniques that use it do not transfer), C++-style RAII is relatively unusual, I don't think any other language requires the programmer to think about virtual versus non-virtual inheritance, the C-derived sequence point rules are obscure and much looser than most languages' evaluation rules, the exception-safety rules are un…

I'd have to disagree with the transitions from C++ to python or java and bash. The complication is C++ specific and moving to java, bash or python is simply removing that complexity. Hence moving to C++ is easier then moving from python or another similar language because in most cases you would be adding complexity. OCaml and Erlang are too different for me to comment about a transition in the functional direction.

But then the whole argument falls appart. Sure if you learn standard boring OOP in C++ then you can apply it. Thats what Java was designed for.

Hoever to even get there you first need to learn incredibly complex nonsense and waste massive amounts of time for knowlage that is virtually useless.

Then you might as well pick up Java, the most popular OOP language and learn it there.

Re: I learnt C++ in 2018 and have no regrets

#153
post #117

Perhaps this is an appopriate place to ask: What is the best C++ IDE on the Mac? In particular, fully project-aware autocomplete is a baseline feature. Does emacs or Vim offer an autocomplete plugin that matches the power of IntelliJ, or even Xcode? Is CLion worth the money? Other paid alternatives?

I haven't used CLion so can't comment on that, but I have tried a few other alternatives. QT Creator [1] has always worked very well for me. If you want to stick with vim there is YouCompleteMe[2]. You can also try using any editor that supports the LanguageServer protocol [3] and then use a C++ language server to provide cross references, hierarchies, completion and more. Microsoft has a language server plugin for vscode [4], there is also CCLS [5], cquery [6] or clangd [7] which can be made to work with both vim and emacs.

[1] https://www.qt.io/download

[2] https://valloric.github.io/YouCompleteMe/

[3] https://langserver.org/

[4] https://marketplace.visualstudio.com/items?itemName=ms-vscod...

[5] https://github.com/MaskRay/ccls

[6] https://github.com/cquery-project/cquery

[7] https://clang.llvm.org/extra/clangd.html

Re: I learnt C++ in 2018 and have no regrets

#154
post #120
post #103

Earlier quoted context omitted.

Because legacy. Maybe one can't reorganise the source tree layout because to do so would break our custom tooling / integration systems / interface with proprietary vendor tools. We can't change version numbering schemes because our packages already exist 'in the wild' and can't be changed mid-sequence without causing both technical and user pain. Fundamentally: the codebase has worked perfectly well this way for the…

Usually this kind of refactor is something done as the very first task following the last release in a minor series and as the first step in a major new release. Going from version 7.4.32 to 8.0.0? Refactor that source tree, reformat all the code, and start over on the build toolchain! Best of all, make sure some junior dev does the actual checkin for the reformat. In all seriousness, I think this is the only way. Ye…

Some of these codebases have 10s of millions of lines if not more. Such a refactoring could take years.

Re: I learnt C++ in 2018 and have no regrets

#156

Earlier quoted context omitted.

Then again, why would you want to choose a language based on whether it's "OO" or not? OOP is just a way of structuring code that fits well in some domains, and fails spectacularly in others[0], and that happens to invite a lot of philosophers (the same way FP invites a lot of mathematicians). It's better to think about the capabilities the tool gives you - what kind of software you can write, what kind of software t…

Wouldn't the main definition of OOP be defined as merging data and functions into a single unit? When using libraries, I find this concept unavoidable for UI and games. I agree though, that having the entire program be a graph of objects is actually usually the worst pattern.

Not really. In fact in Lisp OO is the opposite, the functions are explicitly keeped away from the data.

For Alan Kay it was all about messanging but I dont think most people think about that.

Structs with some kind of dynamic dispatch based on the type would be the most general discription I think.

Re: I learnt C++ in 2018 and have no regrets

#157

"To round up, C++ does not dictate about its tooling, which basically gives lot of choices and flexibility. But at the same time it is making it complex for beginners to come in to projects and start projects with it." This was a big problem for me when I first started using C++. I don't remember it being too bad when I was just working on small projects and things I wanted to do at school. The problems started when…

This is true. Whats even worse, is when you downloads some stuff on GitHub to play around and learn from, and then you get frustrated by lack of ability to build the darn thing!

#beentheredonethat

Re: I learnt C++ in 2018 and have no regrets

#158

> Within C++ is a smaller, simpler, safer language struggling to get out.” - Bjarne Stroustrup Ah, yes. I think they called it "C".

Jokes aside, I think D is it. And with the `-betterC` switch it even has replicated that C subset, but without actual legacy baggage.

Re: I learnt C++ in 2018 and have no regrets

#159
post #88
post #43

Earlier quoted context omitted.

Having opinions != removing choices One can have an opinionated, canonical build system and still allow unorthodox things.

The strong the opinion the harder the unorthodox things are. The weaker the opinion the harder it is for newbies to get going. There is a trade off here.

Seems to me that deep configuration capabilities combined with opinionated defaults address the tradeoff.

Re: I learnt C++ in 2018 and have no regrets

#160

"To round up, C++ does not dictate about its tooling, which basically gives lot of choices and flexibility. But at the same time it is making it complex for beginners to come in to projects and start projects with it." This was a big problem for me when I first started using C++. I don't remember it being too bad when I was just working on small projects and things I wanted to do at school. The problems started when…

I ran into this trying to get into it about 3 weeks ago. I'm so used to things like npm, ruby gems, go packages, pip that it felt like a huge task just to get something built or settle on a way for me to build mine. Even grabbing libraries from github, I was unsure if I should grab just the headers and DLLs, or import the entire tree and mashup my build scripts with theirs. I wish I had stayed with it since college b…

Someone else has mentioned vcpkg. Another project that gets you closer to Rust or Go in this respect is conan, which I really enjoy using. It's still not as polished as other package managers (e.g. maven), but for a lot of very useful libraries, on a reasonable platform (recent OS, recent compiler) and for most important libraries (FFmpeg, boost, abseil, range-v3, the list goes on...) you can just add a single line to your conanfile with the version you want and off you go.

And remember -- a lot of the complexity comes from historical reasons AND also allow you to, e.g. run on, say an Atmel 328p or other microcontroller. So the complexity is partly from having such a wide target area.

Post reply on HN