Live data from Hacker News

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

news.ycombinator.com

161–170 of 199 posts

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

#161

Earlier quoted context omitted.

I assume this is a command-line application? c++ does have a cross-platform GUI problem, unless you pay for the Qt license that is, which is itself a heavy ecosystem to master.

No, it's a GUI application. There are ways of making the GUI parts cross platform, like webview and such. But the GUI parts in this application are native to the OS. "Only" the core functionality is shared between platforms. This is also something I have been battling with in the past. All the cross GUI platforms have their quirks and problems and varying OS dependencies you are then married to. Since this is my own…

then i will have to know how to do GUI natively on mac, windows and gtk/linux, not easy to do them all.

for GUI(not gaming GUI like imgui, I just do normal GUI with widgets) cross platform I "shamelessly" do electron, for non-GUI I'm all the way with c++.

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

#162
post #112

I am (new as in 3-4 years old) - a shared library compiler for a text language, CLI for easy access to compiler and a visual editor for a graph/node-based representation of the text language, used for audio programming primarily in games - built on LLVM (For the compiler) and JUCE (for the graphics). The shared library has few dependencies outside of LLVM so that it can be as portable as possible, and the runtime hoo…

There is no C++19. What do you mean?

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

#163
This year I wrote the latest compiler for jank[1] to be in C++. Originally, this new version was being written in Rust, which I prefer, but I ran into a serious limitation. In the C++ world, we have Cling[2], so I can easily JIT compile arbitrary C++ code and link it to my running process. This is exactly what I need for jank's REPL and JIT capabilities. In the Rust world, such a thing doesn't exist and trying to use rustc as a crate is not well supported at all, all on top of the ABI instability issues.

I model most the C++ code around Rust's semantics for things like option and result. Currently working on replacing my boost::intrusive_ptr usage with an equivalent which is non-nullable, to be combined with option. Even with value semantics, RAII, and hefty TMP for type-rich APIs, C++ still bites in many ways. It's still so easy to have UB compile, including anything from iterator slip ups to interdependent static globals in different TUs with undefined ctor/dtor orders.

1: https://jank-lang.org/ 2: https://root.cern/cling/

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

#164
post #7

Quant trading system/framework. Other languages - scripting in bash, awk, plotting in gnuplot, optionally python matplotlib, data fetching in sql, kdb.

Wanna tell us more? :-) What does this system cover exactly?

Everything ;-) (and more)

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

#165

Earlier quoted context omitted.

I assume this is a command-line application? c++ does have a cross-platform GUI problem, unless you pay for the Qt license that is, which is itself a heavy ecosystem to master.

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

Unless you use the non LGPL modules.

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

#166
post #150
post #145

Earlier quoted context omitted.

What’s your preferred dependency management strategy?

vcpkg is fantastic if all your dependencies are already in there, and still good if you need to add your own ports overlay.

I ended up adopting vcpkg because I started using restinio and the examples all used vcpkg to fetch their dependencies.

It was pretty painless to set up on multiple Linux machines, but both times I've tried on Windows, it's been incredibly painful where I've had to walk through each dependency manually, installing each package manually specifying x64-windows in the triplet, and having different CMake errors on each machine.

This surprised me as vcpkg is actually a Microsoft invention, and seems to be widely praised for reducing configuration woes.

I got things set up and working eventually, at which point I could forget about it, but I definitely plan to get rid of CMake from my build process when I have some time.

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

#167
I prefer Rust over a plethora of other languages.

Before praising, I'll give a bit of my programming background. Early 80's Waterloo Basic on some Commodore Vic20's and 64's, a couple years of C on the Icon but it really sucked because books and software were hard to find and expensive. My brother bought a Hyperion with an early Dos on it and it truly sucked as well for the same reasons Software and Docs were expensive and hard to find. My first real practical PC was an i386 with if I recall correctly 32MB of RAM and I had something like 40GB of hard-drive? I was lucky to get my hands on a Visual Basic and an Microsoft Windows 3.1 Platform SDK which came with the programmer's workbench a TUI IDE for C/C++/MASM with MFC Foundation classes. I was lucky to be introduced to Turbo C++ as well with OWL. Object-Oriented Assembly with TASM came out which was very cool, but masochistic. Very confusing times.

The confusion stopped because when I got hired for a coding job, I was dictated my toolset. They gave us different environments SCO UNIX, SUN OS, Windows for Workgroups(WFWG) 3.11 and some C++ tools for all of them. We built a gui that was consistent on all of them and needed to send/receive stuff. Sprinkle some SQL in there of course. Sprinkle some OOAD diagrams, UML wasn't around yet, but similar notions and diagrams were available for inspiration to communicate with the team.

Later Rational Rose for C++ and Ada was surfacing with some UML and code-generation supporting round-trip engineering. Most of the places I worked at couldn't care less to pay for these kinds of tools since they were simply exclusively priced, but IMHO the Return on Investment was there.

I was privileged enough to have participated in a project that forced me to learn Ada and Java and still required some sprinklings of C/C++/Unix and JNI. The important privilege was to use Rational Rose with a team and everybody was on-board with it. Rose was wonderful and useful to the entire team. Different coding languages in these cases helped to separate the concerns and capabilities. It also helped crystallize the number/type of arguments that should be passed through these different apis & coding languages and to make sure everybody was on same page. After this experience, I also learned to appreciate Ada's strengths. I was annoyed by the overwhelming amount of Ada language terms and the noisy documentation, but the examples were aplenty to get the job done. You had to be patient with the Ada compiler (gnat), but if you could get it to compile, odds are the binary would run and behave as expected most of the time. Most of the bugs we would surface would come from the Java side because Java was more free-style like C/C++. You could compile successfully lots of weird expressions in Java/C/C++ and run-time errors would surface that you would need to take much more time to debug the java/c/C++ for. The ada code was good.

Later on, I would share that Ada is better than java/C/C++/C# but nobody would care much about that and they would be on their merry way doing stuff in their comfort zone languages. At some point in time Ada my hammer for everything even web servers.

Here's the thing, without official credentials and talking to ada employers about ada until I'm blue in the face got me nowhere because of the lack of official credentials the doors were closed. Suffice to say my motivation to continue with Ada waned off.

Other gigs...noise here.

My coding career went idle, went bust. Low-esteem for quite a while. Went to China taught English. The kids over there treated me like a superstar. On my time off, I would play with linux, python, c++, and golang. After 3 years, I returned to Canada, and forced myself to try to market myself as a coder and linux afficionado again. I got a few nibbles here and there. other gigs...noise here...

I finally got some work doing a web site and doing an optical storage appliance using golang and c++ where arose in Linux and Windows. Those gigs dried up.

Finally I was given a gig doing tape storage and I had the freedom to write helper tools in whatever language I deemed best. I chose golang at first, because it could do stuff in parallel easier than anything else I've experienced in other languages. Golang channels are very sweet. I discovered rust in 2017. It had easy parallelism and channels as well, but faster and safer to use. After 3 months attempting to learn and apply rust to re-write the existing golang tools, I had enough confidence to say I could complete the rewrite and gain some performance and reliability advantages from that migration. Contrary to the popular belief that golang projects build faster than rust, I was able to integrate and build all my rust projects in a rust workspace and it built faster(2'ish minutes) than the current golang build (30+ minutes duration). It's true if I were to build all my rust projects individually as separate projects, it would have taken a touch more than 30+ minutes but that is no longer the case with the "rust workspace" paradigm. To help frame this, if I were to re-write these tools in c++, I would possibly get buggier runtimes and the build time would be roughly the equivalent to the rust workspace build time. The runtime performance of an equivalent C++ would be similar to the rust yes, but I would be wasting more time debugging c++ runtime issues that wouldn't have a chance to surface in rust because of all the rust compiler checks and memory ownership it does.

So with all that said and done, NO JOKE, Rust is truly a better tool than C++ to build anything with. It has enough infrastructure to get gui's done with gtk4 or qt on windows, macos and linux on x86_64 or arm64 hardware. Riscv64 support is already there which speaks volumes about rust. If I were to build a gui for riscv64, I wouldn't hesitate to use rust. Sure more painful at compile-time, but it saves you immense time having to debug run-time errors including the worst ones, the intermittent ones that you have to iron out in golang, C++, C#, and java.

Rust is not just trendy, it's the real thing. It's like Ada, but only better. Ada lovers don't flame me. I have my reasons for hating Ada and Ada employers. They're stuck up on credentials and security clearances. I lucked out finding an understanding employer that appreciates my kitchen sink of IT/Tech/Software Developer skills, regardless of my lack of credentials and they benefited from them. I wish everyone here health, happiness and prosperity. I truly believe you'll find it sooner if you get out of your comfort zone and learn and use Rust and linux wherever you can.

Cheers :)

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

#168

All of the recent high-scale data infrastructure projects I've been involved in are written in C++17 or C++20. Mostly fast-twitch analytical database engines and related data processing systems. This is still the go-to language for that kind of systems software, no other programming language is as feature-rich and expressive for that purpose. The other language that gets used a lot is Python for tooling and similar.

I'd argue that both Rust and Java are competitive here

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

#169
post #151

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…

How much additional dev overhead is there in using cpp for the web? How difficult is it to manage updates etc? What are the benefits in your opinion?

Apparently they're using Wt, "webtoolkit".

https://github.com/thebigG/wPedals/blob/main/src/hello.C

> Wt is a web GUI library in modern C++. Quickly develop highly interactive web UIs with widgets, without having to write a single line of JavaScript.

https://www.webtoolkit.eu/wt

Post reply on HN