fell, to programming
@fell@ma.fellr.net avatar

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.

Why is #performance never an academic criteria?

I wish @cmuratori could see this...

#cpp #programming

markuswerle, to rust German
@markuswerle@nrw.social avatar

Because is a secure language you can set RUSTFLAGS to "-zsanitizer =address". I begin to understand.

gracicot, to cpp
@gracicot@mastodon.social avatar

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!) 🤦

blinkygal, to rust

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.

fell, (edited ) to programming
@fell@ma.fellr.net avatar

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:

  1. Fill the canvas with random colours.
  2. Set the first pixel (top left) to red.
  3. 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 recommend zooming in!)

#programming #development #cplusplus #cpp #cpp20 #immediate2d #rgb #hsv #yuv #art #pixelart #rainbow #noise #gamedev #opengl #math #mathematics

jakub_neruda, to cpp Czech

C++20 modules are now foolproofly usable in latest release of MSVC (v17.6.4).

Standard library is precompiled automatically.

CMake code is simpler, target_include_directories are no longer needed.

It only took 3 years. Yaaay!

#cpp #cpp23

Stark9837, to python
@Stark9837@techhub.social avatar

Python import: Advanced Techniques and Tips

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.

https://realpython.com/python-import/#example-use-data-files

#coding #development #opensource #realpython

ncrav, to nature
@ncrav@mas.to avatar

Time for a re- for newer mastodon souls!

Hello! I'm Nuno and this is Lua :DsaprvingLua: !

I do solution architecture, data processing, statistics, and machine learning for a living.

Lua is a master and a connoisseur of the best gourmet woods.

My interests are:






of ideas











gracicot, to cpp
@gracicot@mastodon.social avatar

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.

I'll have to see if it's possible with Clang.

#cpp #cplusplus

omenos, to programming
@omenos@fosstodon.org avatar

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:

strip -s -o ${lang}_strip
du *_strip

C: 16
C++: 76
Go: 1204
Hare: 220
Rust: 352

#c

Paulatics, to cpp

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

blinkygal, to cpp

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.

1/2

fell, to godot
@fell@ma.fellr.net avatar

Guys, it happened. :drgn_flat_sob:

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++.

#Godot #GodotEngine #CPP #CPlusPlus #GDScript #GDExtension #GameDevelopment #GameDev #Prototyping #Programming #Performance #Gaming #RPG #TTRPG #Tabletop #VirtualTabletop

sos, to cpp
@sos@mastodon.gamedev.place avatar

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.

outofcontrol, to cpp
@outofcontrol@phpc.social avatar

Looking for recommendations for a mastodon server for C++ devs #cpp #developers #mastodon

fell, to programming
@fell@ma.fellr.net avatar

One feature I'm always missing is some way to define variables with automatic dirty flags.

Imagine doing object.pos.x += 5.0f; automatically, implicitly sets object.is_dirty = true.

On the instruction level, this would only require one more mov instruction to be inserted, which is super efficient!

I know this is generally what getters/setters are for, but you can't nicely do += with them, or only write the X position.

illusionofmana, to cpp
@illusionofmana@socel.net avatar

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.

Im rusty and looking to sharpen the tool set.

#CPP #CSharp #programming #gamedev #indiedev #dev #opensource

arzi, to gamedev
@arzi@mastodon.gamedev.place avatar

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!"

"Sure, but WHAT ABOUT THE DEPENDENCIES"

Ozzy, to cpp

in case you also wonder and compare vs I ran some code in my old laptop and numbers are fun to share.

cpp is from https://github.com/lehuyduc/1brc-simd and java from https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_royvanrijn.java

for java I used to generate a native binary image and results:

./run_cpp.sh
Using 8 threads

real 0m23.854s

and for java
./calculate_average_royvanrijn.sh

real 0m13.402s

looks like java winning here or am I reading wrong ?

gpakosz, to programming
@gpakosz@mastodon.gamedev.place avatar

Another drop-in 2 files library that you may find handy: https://github.com/gpakosz/uuid4

Robust implementation for UUID v4 generation that works on all major operating systems.

Validated with PractRand and TestU01.

#programming #c #cpp

ramin_hal9001, to cpp
@ramin_hal9001@emacs.ch avatar

C++ is everywhere, that makes ECL very valuable.

The software industry, especially in the realm of free software, has mostly settled on a pattern of using C++ for creating performance critical libraries, and creating Python binding to the C++ libraries for scripting. I was hoping Rust might come along and change all this, but it will take decades.

In the mean time, if you want to use C++ but not actually write C++, you can make use of the ECL Common Lisp compiler, which can compile Lisp to C++ code. This gives you all the best features of Common Lisp for programming with the universe of C++ code libraries available to you. You can use a C++ library and still have Common Lisp macros, garbage collection, high-level scripting, S-expressions as serialization, domain specific languages, a proper meta-object protocol that wraps C++ classes nicely, and wealth of choices for functional programming systems from the untyped lambda calculus all the way up the lambda cube to System-F and the Calculus of Constructs. This not only makes ECL a viable alternative to Python for scripting and app development, but objectively better than Python since you can actually turn your Common Lisp scripts into code that gets compiled into a larger C++ application.

With ECL I would have all sorts of C++ libraries available to me:

  • game engines like Unreal and Godot
  • 3D modeling: FreeCAD, OpenSCAD, Blender
  • Machine learning, big data, and HPC with PyTorch, TensorFlow, OpenCV, OpenCL

I will continue to contribute to the Scheme and Haskell communities as much as I can. I will continue to pursue my dream of an Xfce-like desktop environment written in Scheme. But no matter how I look at it, I am going to more productive in the long run using ECL and C++.

I was hoping that the software industry would gradually shift over to better, more functional languages like Rust and Haskell. And I would love it if Scheme languages could ever begin to seriously replace Python as a scripting language. But realistically, I think I am going to change tack and meet the industry half way. I think I should probably start using ECL as my language of choice, as much as I would prefer Scheme or an ML-family language like Haskell.

#Cpp #CommonLisp #ECL #cplusplus #python

fell, to programming
@fell@ma.fellr.net avatar

Post your latest commit message. I'll start:

> Fixed a possible crash during the trophy cutscene that could happen if the stadium did not have a scheduled match and was not associated with an owning club.

#programming #gamedev #software #dev #development #git #cpp #cplusplus #javascript #python #rust #rustlang #go #golang #coding #c #clang #opensource #foss

secana, to cpp
@secana@mastodon.social avatar

Today I'm going to give a talk on wrapping in to a bunch of developers. Let's see how that goes...

hds, to rust
@hds@hachyderm.io avatar

I came across this article the other day, titled “Why Rust cannot replace C++”.

I feel that the author completely fails to understand the opposing argument. The article claims that with “new” C++ features like smart pointers, you can write safe code in C++, therefore Rust is unnecessary.

But I don’t want a language where I can write safe code, I want a language where I must write safe code.

https://medium.com/@pepitoscrespo/why-rust-cannot-replace-c-but-quite-the-contrary-5577e1f5af0a

StitchedInkMedia, to Canada

With a tenth of the population and workforce, they think they are owed half the country’s CPP. This should be a last straw insult. Canada should have its own referendum on kicking Alberta out, land-lock them, stop subsidies and payments, impose its own charges for anything flowing out, sue for all damages from excessive emissions and say good riddance.

https://calgaryherald.com/news/local-news/alberta-pension-plan-push-destabilizing-says-calgary-chamber

#StitchedInkMedia #Canada #Politics #Enough #BS #Referendum #Kick #Them #Out #Exaggeration #CPP #Tactics #Antics

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • khanakhh
  • mdbf
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • InstantRegret
  • slotface
  • osvaldo12
  • kavyap
  • DreamBathrooms
  • JUstTest
  • Durango
  • everett
  • cisconetworking
  • normalnudes
  • tester
  • ngwrru68w68
  • cubers
  • modclub
  • tacticalgear
  • provamag3
  • Leos
  • anitta
  • lostlight
  • All magazines