Without going into too much detail, my thesis was criticised for developing a web service with C++. I It was questioned why I didn't use #NodeJS or #Java for the web service. "It's not performance critical" said the professor.
Dude, have you used the internet lately?
EVERYTHING is performance critical!
This sort of teaching explains why most aps/websites run like absolute dogshit.
What are the benefits of using C over C++ for greenfield projects, setting aside build times and such.
In other words, is there anything that can be done in C that cannot be done at least equally well in C++? Is there something that can be done in C that just can't be done in C++? What are the dealbreakers?
(No language wars please.)
Boosts appreciated: my sphere of influence is quite small. 🙏
Yay!! Again, some compiler decided to change template conversion operator rules.
And again, compilers won't agree with what the standard says or with each other since changing the rules may break users, even though they keep doing it (even in minor versions!) 🤦
I was experimenting with colour distances at work today. I need to find out how similar two colours are, so I wrote a little test program and it was surprisingly pretty.
The algorithm is simple:
Fill the canvas with random colours.
Set the first pixel (top left) to red.
For all pixels, find the most similar pixel and move it next to the current pixel.
To determine the similarity, I calculated the 3D distance in the RGB, HSV and YUV color spaces, which brought very different results. Now, it's quite possible that my HSV and YUV conversion functions were just broken, but that's okay.
I did another thing. Introduced Error in #SubspaceCpp, and found a suitable pattern to type-erase a concept implementation so that where you'd write &dyn Error in #RustLang you can write const ErrorBase& in #Cpp. And Box<ErrorBase> can be constructed from any Error object e with sus::into(e). That means you can write Result<T, Box<ErrorBase>> in order to put type-erased Error-concept-satisfying types into virtual functions or dynamic library ABIs.
Gotta write a boatload of tests before I put it up as a PR, but I thought this was cool. Particularly pleased with the repeatable mechanism for type-erasure of a concept without being intrusive at all of the type satisfying the concept. That's demonstrated here by the fact one of the error types is actually an enum.
I thought I knew #Python until I read this. The plugins' functionality was quite interesting, and I have a few ideas about what I can use it for. One thing I miss in Python that I often use is in #CPP are true abstract classes, overloading, and extension of classes. With tools like this, you can achieve similar functionality.
Well. I finally finished reading the whole LifeWorks report on setting up an Alberta pension plan. It is…really quite something. Among other things, it suggests that Alberta is actually entitled to 117% of the total value of the CPP investment fund…but recommends that Alberta only (ehem) claim 53% of the CPP’s total assets. The actuarial analysis on which everything else is based assumes that the CPP would hand over that full amount. So.. #CPP#APP#ableg#abpoli
Swift is getting really mature. Stable ABI. Using clang to access and represent C++ types natively. No ffi bindings required. Foundation library available on all desktop platforms.
I hope Rust will start putting some serious effort behind C++ migration/interop. Or I can see a future where the C++ industry migrates largely to Swift, with perhaps Rust libraries for specific tasks like codecs. Which is fine but I worry about some companies, that would be willing to use Rust, never catching up to that.
C++ code will never migrate directly into Safe Rust. Swift found a middle ground for it that Rust will need too. Unsafe Rust needs to become a language people can do their daily work in that is better than C++. That’s what migration can look like.
I was skeptical of Carbon’s plan to build out an unsafe language that is good to work in, since I felt like the safe language is where people should be. I still worry about coming in and building the safe language later, but I can see the value of making an ergonomic unsafe language (nullability for pointers for example), because they are taking seriously the idea of migrating whole C++ codebases to this language. AND understanding that people will be working in that (unsafe) language full time.
Decided to try and compare the general base program size of several languages. I wrote a handful of Hello World programs, and stripped them of everything. Here's the final results in KiB:
As far as I can test, I'm able to do precise reflection on overload set to get the reference kind of each parameters on all overload.
This is true, at least on GCC.
The only way it's possible is to try to call the function many time with a carefully crafted type with a specific set of conversion operators. I can then detect what expressions are ambiguous and which are not and deduce the reference kind of a particular parameter.
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++.
#MacOS inspired application packaging format for #cuteOS.
I finnaly come up with a nice and clean format, and will publish these docs when all of the job will be done.
For running cuteOS app bundles I've made a little program in #cpp called "cute-exec". That will parse the app.json file, locate the executable, and run it.
It'll be better in the future, with bundle scan and bundle verification support.
Just looked up how to do callbacks in C++ and YOU CAN'T (unless you write a bunch of templates and wrappers yourself).
When you pass a pointer to non-static member function, yopu need to handle the class pointer yourself. This is like the simplest thing, why can't C++ have that?
Love how the ISO standard website just tells you "Don't". What a joke.
At the Dev / Tech / Programmer side of Masto.
Looking for C++ Practices.
Is there a solid place online to go and do C++ challenges and practices. I want something that doesn't teach getting started with programming as much as it helps optimize and learn advanced tricks. C# would be cool too.
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!"