Live data from Hacker News

Ask HN: Who is using C++ as the main language for new project?

news.ycombinator.com

171–180 of 199 posts

Re: Ask HN: Who is using C++ as the main language for new project?

#171
post #82

Earlier quoted context omitted.

effective c++ is a bit out of date but still very good. i read it while learning c++ 'properly' last year and found it very helpful, but it helps to have some knowledge of modern c++ to know what is still relevant. there isn't much overlap with effective modern c++.

I don’t think he’s talking about the old effective C++ book, but rather the “effective modern C++” book as stated in the post.

i was trying to say that he should read both

Re: Ask HN: Who is using C++ as the main language for new project?

#172
post #82

Earlier quoted context omitted.

I don’t think he’s talking about the old effective C++ book, but rather the “effective modern C++” book as stated in the post.

I think I got the right one. https://www.amazon.com/Effective-Modern-Specific-Ways-Improv... Was printed in 2014. The older one which is `effective C++` is printed in 2005.

yeah maybe my message wasn't clear, i was trying to say that you should read both, the old one is still valuable

Re: Ask HN: Who is using C++ as the main language for new project?

#173
I started a few months ago a personal home finance manager which includes other nice things - in Flutter (!!!). Then I decided to switch to Python and Qt because Flutter for desktop is still not a thing, and finally to c++ and qt6, because on my Mac a simple app took a lot of time to boot (> 5 seconds) and an idle window, not hello world, was using 70MB of ram. Blame it on pyinstaller or whatever other reason, well, it's then that I decided that for my own hobby project without (paid) deadlines I don't have to follow trends like Electron or easier alternatives like PySide just to "deliver something". I want to provide a low-memory low-cpu usage alternative and possibly something I can also install on mobile as well.

I always wanted to learn C++ and never got the chance to use it for work, so I started reading the most significant books and resources suggested by [0], including learning how modern projects do things - on this, Jason Turner's template comes handy.

In the beginning it was tough, and at times it still is, however I am getting more and more familiar with the way things are done.

At first I chose Meson for "simplicity" but it took me a while to realise that Cmake is actually pretty easy as well, so I switched to Cmake and started using Conan.

My project setup is slowly converging to [1] - I couldn't just use it without having any knowledge about c++.

I am happy that someone packaged a lot of good and modern practices in such a repo. (I know they are good because the approach is quite common with other languages/technologies too).

There is way more to learn than with other languages, but it's interesting. Plus, i watched one or two videos from the creator of the language, and I like his philosophy of "freedom", which I believe is one of the main issues nowadays with c++, as most developers just want a prepackaged set of tools and APIs to develop and deliver fast, without thinking too much - c++ clearly doesn't get along with this type of developer.

The project consists of:

- C++20 with Clang - clang-format - clang-tidy - project_options with dev mode and other sanitizers on - Cmake/ninja - Conan - lots of nice things provided by the

- catch2 - qt6 - TOML for internal configuration - Sqlite3 for DB

- github/actions for CI/CD

I still haven't use Valgrind, still an amateur afterall:)

[0]: https://github.com/rigtorp/awesome-modern-cpp [1]: https://github.com/cpp-best-practices/gui_starter_template

Re: Ask HN: Who is using C++ as the main language for new project?

#175
I've been writing a cross-platform UI toolkit, currently macOS, Windows, and Linux. Eventually I'd like to compile for wasm/Canvas, android, and iOS. C++ was sort of designed for this kind of thing, it is performant, and it interfaces with the OS well. Eventually I'd like to have at least Python, Swift, and Rust bindings, because I really like using Swift, but none of the UI parts are available outside macOS.

It's probably not ready for use yet, but give it six months or so: https://github.com/eightbrains/uitk

Re: Ask HN: Who is using C++ as the main language for new project?

#176
post #82

Earlier quoted context omitted.

I don’t think he’s talking about the old effective C++ book, but rather the “effective modern C++” book as stated in the post.

i was trying to say that he should read both

Ah, got it; sorry I misunderstood it.

Re: Ask HN: Who is using C++ as the main language for new project?

#177
post #145

I almost exclusively use C++ for my projects. Especially modern C++. When it makes sense(especially for dev tools), I use Python since for those I'm not so worried about distribution and long-term robustness. Anyway here they are: Qt desktop app written in C++: https://github.com/thebigG/Tasker Simple GPIO front-end for linux GPIO driver(could definitely use some improvement) written in C++ and uses boost: https://gi…

What’s your preferred dependency management strategy?

I know this is a bit of a loaded question in the C/C++ world. But really depends on the project. Most cases it seems I go with CMake just because that's what everybody seems to use most of the time. But I do long for the day that modules get fully implemented in all compilers and we get some kind of standardized solution that's akin to Cargo/npm/maven... One day. I try my best to keep things simple.

Re: Ask HN: Who is using C++ as the main language for new project?

#178
post #126

Earlier quoted context omitted.

You'll just do a clone in Rust in a year or so, if the C++ version turns out to be useful :-)

Exactly, and the Rust version will "mysteriously" turn out to have fewer security vulnerabilities, scale beyond 1 CPU core, and have a nicer CLI interface :-)

Because a rewrite in the original language never sees improvements like that...

Re: Ask HN: Who is using C++ as the main language for new project?

#179
post #155

Earlier quoted context omitted.

Came here to write pretty much exactly what you said. I'm using ESP32-S3 chips in a project. Rust support is really nascent and I can't afford to burn too much time on fixing tooling & recreating libraries. Though it does sound kinda fun. But I imagine there's a chicken/egg challenge where it's hard to see Rust on embedded platforms get more mature unless it gets more adoption and it's hard to imagine a significant u…

> Modern C++ is getting a little better all the time. Honestly, this is the reason I haven't moved anything to Rust, despite seriously considering it in the past. I would ditch C++03 in a heartbeat, but C++14 and beyond are very usable. C++ could certainly be better - I'm hopeful about Carbon - but it's good enough and improving fast enough that if you're already a C++ expert, I think you're pretty happy.

Constexpr all the things is kind of a super-power of C++. Zig has an even more powerful comptime feature, but that's an aside.

(Bonus points: Declare a static constexpr value in a compilation unit... and use it somewhere at runtime to get the moral equivalent of consteval for the values you care about.)

Re: Ask HN: Who is using C++ as the main language for new project?

#180

Earlier quoted context omitted.

Qt is LGPL, no need to pay for a license.

Not that simple, I think it's more than LGPL, IANAL however, its license always confuses me.

Technically, LGPL is also problematic whenever used in appstore applications.
Post reply on HN