Why does assigning a function to a struct bloat my binary size?

For some reason when I assign a function to a struct, my compiled binary size jumps up 0.5kb. I know it is the struct causing this because I can use the function in other parts of my code without it jumping up.

The reason I am storing it in a struct anyways is because I need to iterate over some data & find the relevant function to act on that data. Checking every possibility & calling the specific function name from there doesn't sound fun.

I wouldn't mind the 0.5k if it was just that, but I have a ton of little modules each with their own struct instance holding their own separate function & it stacks up quick.

Here is one of my modules so I can show an example of what EXACTLY I am doing that is causing this behavior:

\#pragma once



\#include "../Common.hpp"

\#include "../ScopeState.hpp"





void INST\_End\_exec(const Instruction& inst, const InstToken& token, ScopeState& state, const std::vector<std::string>& args, const std::string& symbol) {

	return;

}





Instruction INST\_End {

	0,

	0,

	//INST\_End\_exec,

};

Un-commenting the `//INST_End_exec` line bumps the size, & I'm pretty sure it's not that the compiler was just passing over the function before, because I use it in other parts of my code-base.

I would be really grateful if someone told me why this is the case & if theres an alternative way I can store my functions...

reddit.com
u/PhosXD — 9 hours ago

Inexplicable / unpredictable error with std::unordered_map.find?

Hello all, I started my first project in C++ as a learning experience just about 3 days ago & I have already run into various blood boiling frustrations, but most of all THIS one! For the past 18 hours I have been trying to figure out why for the love of everything good why this code here results in a runtime termination:

op.type_map.find(get_variant_data_type(first.d))

First let me explain everything here.
- `op` This is the struct which holds my unordered map. Confirmed to exist & be properly defined.
- `type_map` This is the actual unordered map, it's type is such: `std::unordered_map<VariantType,std::vector<VariantType>`
- `VariantType` is an enum, but the bug still happens with strings as well, so I dont think this has any correlation.
- `get_variant_data_type` is a function that takes a `VariantData` struct & gets it's corresponding `VariantType`, I have confirmed this is returning the correct value.

Here is the actual value of `op.type_map`:
```
{

{INT, {INT,FLOAT}},

{FLOAT, {FLOAT,INT}},

{STR, {STR}},

},
```

I genuinely have no idea what's going on, `.find` works everywhere else in my code but this specific line has problems, here is the runtime error it produces:
```
terminate called after throwing an instance of 'std::out_of_range'
 what():  unordered_map::at

```

I am not using `.at` anywhere in my code base btw, & the error goes away after removing the use of `.find`. If anyone has any idea why this might be happening please do tell me this has been so frustrating to deal with not knowing the actual cause.

reddit.com
u/PhosXD — 3 days ago
▲ 316 r/godot

It's a joke... Right?

Charging for a simple plugin that honestly doesn't even need to be a plugin with how simple the functionality it claims to implement is. At least there's a free version, but still.

https://preview.redd.it/39g3qikqx39h1.png?width=912&format=png&auto=webp&s=6d0a6d1914cb99796eb3e720776e1a0eb068bf1a

https://preview.redd.it/jl5nh9vby39h1.png?width=900&format=png&auto=webp&s=a3ce68384d991588e17d1355441106ce14be10e7

But maybe I'm wrong & the plugin is so good that it's worth paying $5 for, maybe I'm just misunderstanding what it is, I hope I am.

Help me out here. Let me know if I'm just crazy.

https://preview.redd.it/8nqcsimoz39h1.png?width=897&format=png&auto=webp&s=8388df240e4d291f656f0dff4e2ec10378b3c5a4

Oh wait... They got a whole business going. All released in the same 3-day period. Github account created 2 days ago. Their username is the most generic thing ever.

Btw Im looking at some of these plugins & the things they do are exactly what the title says, there's nothing special to it, no special features any developer couldn't add themselves with a few spare minutes. The only thing special about these plugins is that they are artificially limited & you have to purchase the "PRO" version to unlock basic stuff built into Godot.

Sorry if I am coming off mean or angry here. I genuinely am a little mad that someone is trying to profit off of basic stuff, like they're targeting newbies who don't know better, who likely don't know that free & far better solutions exist. I guess this is what eventually happens to any community when it gets popular.

Yikes sorry for the rant. Let me know your thoughts on this

reddit.com
u/PhosXD — 13 days ago

Fortnite is infiltrating my feed, help.

I dont play fortnite. I never interacted with anything fortnite related on reddit. I dont watch fortnite content. I dont like fortnite.

Everytime I see a fortnite post I hide & click "show fewer posts like this" it because I am genuinely not interested. But every time I get on reddit it's 3 or 4 new fortnite posts in my feed. Its to the point where the "Show fewer like this" button has disappeared & now it only lets me hide individual posts which is useless.

Why wont rFortNiteBR go the fuck away & how do I exile the bastard?

reddit.com
u/PhosXD — 21 days ago
▲ 5 r/aiwars

Literally sums up my stance perfectly.

If you have the time, sit down, watch the video, he makes a lot of good points.

Here's a list of my top arguments most of which are partially covered in the video, discuss them with me:

AI is a net negative

For every good thing it can do, there's twice as many terrible things it can do.

Video generation:

- Harmless memes (sure ok)

- Cheap, high-volume advertising (I don't like it, but sure if it saves you a few bucks have the fuck at it)

- Scam videos (bad)

- Propaganda (bad)

- Deceptive videos (fake news, events, people, etc, BAD)

- Generating sexual videos of children, & unwilling people on the internet (I shouldn't even have to say this, but this is BAD)

Text generation:

- Touch up your emails (sure ok)

- Haha look funny chatbot said funny thing (sure whatever)

- Dynamic dialogue in games (sure ok)

- Data analysis & or sorting (GOOD, probably the only justifiable use case imo)

- High-volume & highly optimized scam texts / emails or whatever (BAD, I know not everyone is easily scammed, but it is still potentially dangerous to the elderly, mentally ill, or just those who aren't very aware of the technology)

- High-volume misinformation in books, news articles, & scientific papers (BAD)

- High-volume & highly convincing fake comments & product reviews (BAD)

- Confidently incorrect & emotionally manipulative chatbots (BAD. Lead to many proven supa side & murder cases, also causes delusion)

Actual scientific research:

Well pretty much all of it is good, the problem is that it is few & far between.

When you compare the pros & cons all up against each other, it's impossible to deny that the world would be & wouldve been an all around better place for everybody if the technology didn't exist.

AI devalues everything it touches

Image & video generation has gotten to the point where leading models are most of the time impossible to tell apart from real images or videos. When everyone has the ability to create near perfect looking images in a matter of seconds, you in specific stop being special, you have no skill or experience that sets you apart from everyone else who has access to an image generator.

What's ironic though, is that real artists are less affected by this than regular people, because they understand the value in their craft. It's less the raw output that matters, but more what went into it.

Art stripped of it's soul, intent, or emotion, is not art, it's a product. When a machine does all the work for you, any meaning you thought you had put into your work has been invalidated because when you remove the effort, you enforce the idea that whatever meaning you are trying to convey isn't *worth* putting effort into, it is therefor worthless by your own.

AI is costly

Okay, so even if you are fine with consuming & creating Gen AI content (which I maintain the right to call you a sloplover or slopfactory if you do, because I personally don't like it, it's my preference) you still can't deny that there is a real world environmental & economical cost to what you are doing which is where the morality argument comes into play because you are affecting real lives. Let's break down what the cost is exactly:

Water:

Yes I know this is sometimes overblown, & doesn't use as much water as other industries. But it's still a lot of water that is used for cooling the data centers powering Gen AI. Most of the numbers aren't even very public, still the numbers we ARE provided with aren't very good & that should be a sign. New datacenters have been proven to cause local water shortage in some local areas.

Electricity:

This is a much larger issue than water. The price for electricity is actively going up & some power grids cannot even keep up with the demand datacenteres are bringing. Now let me ask you something: how do you think electricity is made? What happens when we cant keep up with the energy demand? Do you really think this is a good thing for the environment & your energy bill?

youtube.com
u/PhosXD — 1 month ago
▲ 36 r/ask

Is it normal to have a "cold" eye &amp; a "warm" eye?

Just wanted to ask because I never bothered to before, just want to check if it's one of those things that feel normal until you find out it's not...

Edit: to test this yourself, close one eye & compare the colors you see on a solid color background. For me my right eye has a warmer tone than my left

reddit.com
u/PhosXD — 2 months ago
▲ 7 r/lmms

No matter where I look, there seems to be no clear answer whether or not LINUX VSTs are able to be used on the LINUX version of LMMS. Hoping this sub will be able to help, I really would want to get back into LMMS but no VST support is really putting me off.

reddit.com
u/PhosXD — 2 months ago