jakub_neruda, to cpp Czech

Funny. I removed all modules from my C++ codebase (roughly 10% of it) and I got about 10-16% shorter compilation times. Not to mention Intellisense no longer crashing all over the place.

I wonder if it ever be a worthwhile feature to use.

Schlangenmensch, to cpp German

Does anybody know when it will be possible to mix #c++ named and classic with ?

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

C++ compiler be like:

error LNK2001: unresolved external symbol "public: static class std::unordered_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,struct std::hash<class std::basic_string<char,struct std::char_traits<cha r>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,unsigned int> > > TextureStore::texture_cache" (?texture_cache@TextureStore@@2V?$unordered_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IU?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits @D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@std@@@2@@std@@A)

And expect me to casually read that and go "Ah, I see".

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

Good morning everyone ☕

fatal error C1001: Internal compiler error.  
error D8040: error creating or communicating with child process  

MSVC agrees: It sure is a monday.

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

I really like C++, but this is the satanic ritual required to get a file modification date:

auto ftime = std::filesystem::last_write_time("file.txt");  
auto stime = std::chrono::clock_cast<std::chrono::system_clock>(ftime);  
auto time = std::chrono::system_clock::to_time_t(stime);  
auto ltime = std::localtime(&time);  
auto year = 1900 + ltime->tm_year;  
auto month = ltime->tm_mon;  
auto day = ltime->tm_mday;  

:drgn_confused:

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

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.

(Actual results of my work, I am SO proud!!! 🥳)

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

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.

fell,
@fell@ma.fellr.net avatar

@SonnyBonds We use C++ bitfields:

struct Object {  
 bool is_active:1 = 0;  
 bool is_dirty:1 = 0;  
}  

So, each member is just one bit. The default value only works in C++20 but the bitfields are C++11 I think.

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

Okay, I need the swarm intelligence regarding :

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?

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

So, like many folks, I'm doing a bit of saturday work from home to support the project as it is getting closer to release.

Since my home desktop is primarily a system, I decided to try and see if I could compile a game without Windows.

Short answer: No. I could not.

There is actually an package that gives you a working compiler in , but there is no way to get to work to build .sln and .vcxproj files.

I wonder how much worse the build time would be in a VM 🤔

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

fell,
@fell@ma.fellr.net avatar
pgs,
folkerschamel, to cpp

This gives hope for humanity.

#cpp #cpp20 #z80

  • 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