13 ms·
Somewhat off topic, but I'm increasingly finding that Qt is the last remaining reason to use C++. Qt is amazing, but C++ isn't a very productive language to cod
by skrebbel 9y ago
Somewhat off topic, but I'm increasingly finding that Qt is the last remaining reason to use C++. Qt is amazing, but C++ isn't a very productive language to code in, even if you're good at it. OS-less microcontroller stuff is probably better done with plain C, and everything else (games, system programming, embedded programming with an OS, etc) has mature and better options available such as Rust, Go, Nim, and (particularly for gamedev) C#.
But none of those languages have Qt. Of course, there's stuff like PyQt which is nice, but it's not got the status that C++ has in Qt land. Really what I'd love is if Qt would add first-class support for one of those newer languages. Rust maybe? I reckon it's a enormous, maybe simply unfeasible undertaking, but first-class Rust support, so I can fire up Qt Creator and start coding Qt apps in Rust would be fantastic. It would suddenly increase the usefulness of Rust by enormous amounts and it would keep Qt relevant.
Does anyone know if the Qt people are evaluating other languages? Are they worried, commercially, about C++'s demise?
- jhasse 9y agoPyQt seems to work quite well, for example fman is written in it: https://fman.io/ https://fman.io/ Regarding gamedev: Unity itself is still written in C++ and Unreal Engine uses it even more. AAA games are written mostly in C++ with Lua/C#/Python for scripting. There are still a lot of other reasons to use C++, too.
- book_mentioned 9y agoShow HN: Cross-platform desktop applications with PyQT | https://news.ycombinator.com/item?id=16318677 https://news.ycombinator.com/item?id=16318677 (yesterday)
- Nokinside 9y agoPaying customers for Qt are still very C++/C oriented. Qt goes where the money is, and it seems to be in contracts with large manufacturers and focus in embedded systems, especially the automotive industry, automation and digital television. The QNX and INTEGRITY support is big deal in many industries.
- simonh 9y agoIsn’t it a truism though that the existing customers for a C++ tool will be very C++ oriented? Surely the real question is where is the potential growth, and future customers.
- snarfy 9y ago> and everything else (games, system programming, embedded programming with an OS, etc) has mature and better options available such as Rust, Go, Nim, and (particularly for gamedev) C#. None of the options you mention, other than possibly Rust,is actually appropriate for game engines, systems programming, or embedded, due to the garbage collector. There are still plenty of good reasons to use C++, not just Qt.
- ronjouch 9y agoWhen mentioning C# "for gamedev", OP was probably talking about games business logic. The Unity core engine may be C++ (and assembly and shaders), but many Unity users / developers seem to do well with C# game logic / scripting. EDIT question to Unity devs more experienced than I am: how frequent is it to "escape hatch" from C# to C++ game logic, in your experience? In what kind of game?
- m_t 9y agoFrom my experience, not that frequent. Had the occasion to watch a conference from a Dev in my company that would get rid of a lot of the overhead added by the Mono Behaviour in Unity. Getting better performances at the cost of less usability. In that case, one wonder why event bother using Unity?
- BoorishBears 9y agoFor normal game logic I doubt the average user will ever cross that barrier. C# in Unity can be blistering fast despite the GC if written correctly, and going to C++ still requires about as much (if not more) effort and knowledge as writing C# in a GC friendly way
- skrebbel 9y agoNim is perfectly good for embedded. Also, GC is fine for the vast majority of systems programming. Finally, lots and lots of embedded programming doesn't need to be hard real-time. I'd wager that the majority of embedded projects are in C++ not because of any technical requirement but because the people in the field know only 1 language. (Note: I already addressed OS-less microcontroller programming in my top comment.) I agree that I was wrong about gamedev, in the sense that popular game engines are also, currently, written in C++ (so play a role in keeping C++ alive by legacy, just like Qt does)
- wsgeek 9y agoA reasonable question, but the reality is that C++ is the ONLY choice for certain fields (basically anything where you need a high-performance "engine" under the hood). Finance, gaming, databases, etc.
- deleted 9y ago[deleted]
- blub 9y ago"everything else (games, system programming, embedded programming with an OS, etc) has mature and better options available such as Rust, Go, Nim, and (particularly for gamedev) C#." We're supposed to interpret other comments in the most charitable way, but a charitable interpetation is not at all possible when one says that C# is a usable solution for systems and embedded programming, that Nim is mature, or go is used in games and is a good idea to use for embedded. Even combining all of the above languages would not reach the breadth and maturity of C++ in the target domains.
- badsectoracula 9y agoMentioning C# for gamedev and the topic being about GUIs, makes me wonder if he was talking about tools? C# with WinForms are very popular for creating tools in game studios (if you notice tool screenshots from presentations like GDC, you'll often see the telltale marks of WinForms - like the gradient menubar, the default icon, the extra padding around some elements, etc).
- BoorishBears 9y agoAre we collectively forgetting Unity3D? It might only be one engine but it’s a juggernaut in the industry
- banachtarski 9y agoC# is actually "Unity script" and compiles to C++. It even bundles its own C++ garbage collector. It's terrible. Not being able to write native code is a tremendous weakness of the engine. Not to mention that since you're writing a "fake" C#, you don't get the full runtime (can't use reflection, can't use coalescing null features, etc).
- pjmlp 9y agoThey are in the process of adopting .NET 4.6. IL2CPP is no different from CFront.
- 9y ago
- pjmlp 9y agoC++ isn't going anywhere for the foreseeable future. Yes, Qt is the only pure C++ cross platform GUI with high quality tooling. However on Windows there is still UWP, mostly written in C++. What is happening is a shift of focus, instead of doing a full app 100% in C++. C++ gets used where it is best, low level high performance library code, with higher level code being written in a safer language. So while the app developer might stick with Swift, Java, Kotlin, Web browser, .NET, there is still a C++ layer underneath. For example, Metal shaders are written in C++14. Also IoT has given a big push to C++, Arduinos, ESP286, ESP32 kind of devices are mostly developed in C++. So yeah, there are still a couple of decades of C++ on native GUIs, if nothing else, pushing pixels around.
- earenndil 9y ago> Yes, Qt is the only pure C++ cross platform GUI with high quality tooling Sure. But what about, e.g., gtk?
- pjmlp 9y agoGtk+ is a C toolkit, and regarding tooling, Glade isn't as feature rich, both Builder and Anjuta are just ok IDEs. Also they are mostly focused on being a good UNIX toolkit.
- Mikeb85 9y agoRust isn't that mature for games, ditto with Nim, Go is ok but has a GC, C# is too slow but OK for scripting, but then again lots of languages can be used for scripting. C++ isn't going anywhere in the game development world for now. Maybe something like Rust will upend it someday, but not yet.
- pjmlp 9y agoI agree, but it is also a matter of hardware resources. Back in the 80 and early 90's, languages like C, Turbo Pascal, Basic,.... where the scripting languages, with the core implemented in Assembly. Then the ladder moved up and they started to be used to implement the engines. Same happened with C vs C++. Now we are on the C++ vs GC languages phase. C++ won't be gone from the pixel pusher and real time audio layers for a long time, but the other layers willl eventually use something else.
- oever 9y agoRust and C++, esp how Qt uses it do not mix very well in my opinion. For that reason I created tool to create bindings rom a JSON model to both Qt and Rust. You write the application logic in Rust and the UI in Qt. A talk at FOSDEM 2018 about that is here https://fosdem.org/2018/schedule/event/rust_qt_binding_generator/ https://fosdem.org/2018/schedule/event/rust_qt_binding_gener...
- zwieback 9y agoI'm a bit allergic to proclamations of C++ obsolescence but to be honest I'm finding myself using it less and less myself. Not sure I agree OS-less micros are best done with plain C, though. A lot of programmers are put off by the latest C++ developments but it's very possible to use C++ to great advantage even in tiny environments. You just have to really know what you're doing.
- coldtea 9y ago>everything else (games, system programming, embedded programming with an OS, etc) has mature and better options available such as Rust, Go, Nim, and (particularly for gamedev) C#. That's not how the industry sees it. Almost nobody does those things in Rust, Go, Nim and C# (except if you mean second tier not AAA games done in Unity and co). And by nobody I mean less than 1% of those that deliver those kinds of solutions use those languages.
- banachtarski 9y agoI see this sentiment all the time and the answer is "nooooo." It's honestly getting frustrating, and I tire of writing the same apologia. No C++ isn't unproductive. Go and C# is NOT FAST OR SUITABLE FOR GAME DEV (AAA in particular but even lighter games. You'll pry manual memory management from me from my cold dead hands). Maybe you mention C# because it "powers" Unity? Guess what, it compiles to C++ through the IL backend. Other languages haven't figured out cross-platform. And I don't mean Mac and PC. I mean Mac, PC, iPhone, Android, Linux, Playstation, Xbox, etc. People keep writing about C++'s demise, but I don't see them writing LCP constraint solvers in other languages successfully. I will submit that of the things you mentioned, Rust and Nim are closer to the target since, at least, they don't run on this slow as molasses runtime (slow in game terms), but they are extreeeeeeemely immature, and you're talking on porting very complex problems. No thanks, I'll take the thing that has an actual standards committee where I can determine exactly how to control or tweak things at whim. Basically, this type of comment is always a cheap shot to get upvotes but simultaneously always misinformed and from someone without actual game development experience.
- pjmlp 9y agoJust like C++ used to be compiled to C. There are many valid uses for C++, however using IL2CPP as an example, well that is just an implementation detail of their C# compiler. If Unity would be willing to spend the money, they could have implemented a compiler backed instead.
- banachtarski 9y agoThe usage of a GC changes the nature of the solution entirely. Say you wanted to write a bullet hell game. Spawning bullets/spells in the thousands takes pretty careful management and without memory management, understanding where you've leaked or why memory isn't being reclaimed when you expect can be nightmarish.
- pjmlp 9y agoSame applies to malloc()/new, no one on their right mind would be allocating during the hot path of rendering loop. With GC languages, one just needs to learn about value and reference types, and which language features might implicitly allocate. Which can be helped via static analysis. Regarding .NET specifically, there are quite a few ways of doing manual memory management, although not as fine grained as C++, which many devs seem to be completely unaware of. In both scenarios, using a profiler is a must have for anyone caring about performance. And lets be real, unless one is competing with AAA level games, there is a big spectrum of game styles that don't need the ultimate hardware performance, just good enough for an enjoyable game experience.
- jrs95 9y agoIt'd be interesting if Qt had something like Vala for GTK
- jcelerier 9y agoLook into QML : http://qmlbook.github.io/en/ch04/index.html http://qmlbook.github.io/en/ch04/index.html
- laythea 9y agoI'm sorry but I disagree. Mature Rust is not the same as mature C++. If you are a commercial entity you would, in my opinion, be fool-hearty to select a language like Rust, mature in the sense you mean or not, as the main language of use. Or at all quite frankly, for the single reason that it is more difficult to employ quality people as the talent pool to draw from is far too small. And it is also the reason I never invested myself to learn it, for its technical merits or not.
- steveklabnik 9y agoOver a hundred companies, including some big ones, disagree with your opinion here: https://www.rust-lang.org/en-US/friends.html https://www.rust-lang.org/en-US/friends.html "A hundred companies" is both good and bad, of course: that's a drop in the bucket compared to C++. It's also not nothing.
- laythea 9y agoJust to clarify, I agree, it's not nothing. But still.