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

smurthys, (edited ) to programming
@smurthys@hachyderm.io avatar

A serious question for C and C++ programmers:

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

#c #cpp #cplusplus

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

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

#cpp #cplusplus

fell, (edited ) to programming
@fell@ma.fellr.net avatar
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!) 🤦

#cpp #cplusplus #msvc #clang #gcc

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

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.

jakub_neruda, to cpp Czech
@jakub_neruda@techhub.social avatar

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!

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











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

Paulatics, to cpp
@Paulatics@mstdn.ca avatar

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

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

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

chumii, to programming German

https://git.floating-in.space/isabell/2023_OOP_Cpp/src/branch/main/assignments/06/ThinkPink daran bastel ich gerade

bis jetzt ist noch nicht mal das UI selber fertig, aber ich bin fleißig dran.

Das wird meine eigene persönliche Implementierung vom https://de.wikipedia.org/wiki/SameGame mit den default-Farben als Rosa-tönen natürlich.

Ich bemühe mich, es komplett plattform-unabhängig zu basteln!

Macht mir gerade richtig viel Spaß ❤️
#cpp #qt #qt6 #girldev

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

nitrogenez, to programming Ukrainian

There it is.

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

app.json description coming soon.

outofcontrol, to cpp
@outofcontrol@phpc.social avatar

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

smurthys, to programming
@smurthys@hachyderm.io avatar

Wish I'd the confidence of people who self-assess their C++ knowledge to be 10/10.

<insert link to Stroustrup saying his C++ knowledge is 7 or 8 or such. Someone give me a link please>

#cpp #cplusplus

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.

#cpp #programming

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

One #programming 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.

#cpp #cplusplus #gamedev

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.

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"

#gamedev #cpp #programming

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

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