Engine programmers literally only want one thing and it's fucking disgusting:
> The game has PASSED the Hardware/Software Compatibility and Performance Check with a great majority of systems obtaining excellent performance results.
Reminder that the #programming languages useful for #applications may not be the same as those used for #libraries that the applications use, and this is just fine, e.g. performance often requires that one does not rediscover the wheel by recoding libraries in #clang#cplusplus and #fortran because they are, for whatever reason , resistant to use a proper #ffi (or an #IPC) #api.
In modern C++, when I'm writing constexpr static data member of an integral type, I find myself using the pre-C++11 hack of enum { value = ... };. Why? Well, I could write static constexpr auto value = ... but the hack is shorter and less noise than the real syntax for it 😕
What's your favorite way of doing type safe flags in C++? I typically just use some enum/int combo, but it's not really type safe and you can combine flags from different sets.
Despite me being an absolute performance addict beyond reason, I have decided not to write my dice roller entirely in C++, for now. At least not until Godot 4.2 comes out, which brings hot-reloading to GDExtension.
GDScript is slow, and I really hate wasting people's CPU cycles, but prototyping the game logic is just so much quicker because it's right in the editor and changes are applied immediately.
I am also certain that I will be able to convert GDScript to GDExtension C++ fairly easily, because all I do is call engine functions, basically. It's just a matter of translating the syntax.
Last but not least, It would make a nice case study to directly compare the same implementations in GDScript and GDExtension C++.
Join C++ experts Robert Seacord and Jessica Paquette to learn about improving optimization.
✅ Date & Time: November 21, 2023, 6:30-8:30 pm (JST)
✅ Format: Joint presentation followed by networking
✅ Location: Woven by Toyota Tokyo Office
✅ RSVP by November 14th at 12pm
Let's say I write a function like this, in C++17 or later:
inline int Calculate(int a, int b) {
return a+b;
}
I put it in a file called calculate.h and include (and use) it at multiple other places in the code.
Let's assume the function is not inlined at call sites. Due to the inline keyword, the compiler will ensure that Calculate() exists only once. (See https://en.cppreference.com/w/cpp/language/inline)
Question: Will the compiler generate the instructions multiple times, or does it avoid compiling a function body that's already going to be compiled in a different translation unit?
In other words: Do lots of inline functions in header files slow down compilation?
What they don't tell you about C++ is that while the language itself isn't too bad, getting anything above a very vanilla console app to compile needs HOURS of work googling and twiddling with frameworks and packages and include paths and obscure nuget errors no one else seems to have encountered before.
"OpenGL context with just a couple of lines of code!"
@arzi#CPlusPlus programmers are rolling their eyes at the amount of dependencies #Rust / #JavaScript etc. projects use. But the only reason C++ projects don’t have more dependencies is because it’s literally impossible to use them.
Context: I’ve been using C++ for 20+ years and I still hate having to integrate dependencies
Another bit of gold from #ICFP2023 by Pjotr Prins of the University of Tennessee. The actual title of the talk is "Why code in Python+C if you can code in Lisp+Zig?" but the "Lisp" in this case is actually Guile Scheme. I didn't know this, but Zig uses the C ABI so it binds to any language that can do FFI bindings to C, including most Scheme and Common Lisp implementations. But why don't I just post the abstract here:
> "Most bioinformatics software today is written in Python and for performance C is used. Lisp has been around for over half a century and here I don’t have to tell how or why programming Lisp is great. I will talk about Zig as a minimalistic new language that is unapologetically focused on performance, tellingly with a blazingly fast compiler. It is advertised as a replacement for Thompson, Ritchie, and Kernighan’s C, but it may even replace C++ in places. Zig uses the C-ABI and does not do garbage collection, so it is ideal for binding against other languages. In this talk I will present combining GNU Guile Lisp with Zig. I’ll argue that everyone needs two languages: one for quick coding and one for performance. With Guile and Zig you get both at the same time and you won’t have to fight the Rust borrow checker either."
If you're in or near Amsterdam: I'll be speaking at the Dutch C++ group on November 23rd about think-cell's core library and ways we work around flaws in C++. It's free to attend, but spots are limited.