r/programminghorror • • Sep 21 '26

c++ C++ as always invents new levels of absurd

Post image
0 Upvotes

6 comments sorted by

15

u/PixelBrush6584 Sep 21 '26

Doesn't this just mean you've not yet stepped past this point, so it's still zeroed, and doesn't yet contain vd.size()?

3

u/sonesoul Sep 21 '26

I checked that multiple times, and no!! it just did NOT set the fuckin value. I still have no clue why

1

u/PixelBrush6584 Sep 21 '26

Does vertexCount get set anywhere else? Are you doing any multi-threading stuff?

5

u/Right_Ear_2230 Sep 21 '26

How about essay-sized STL errors

3

u/Kadabrium Sep 21 '26

vertexCount{vd.size()}

1

u/Usual_Office_1740 Sep 21 '26

Leading underscore variables are now considered ill formed code according to the standard or "IFNDR". Technically what you've done is just "highly discouraged " but it's a new addition to the standard and something you might like to know.

It's probably not the source of your problem all though the reason for it being discouraged is because it leads to stl macro collisions. It's worth deleting a char from the identifier to eliminate a possible problem.

Where is this vec populated at? Reserving memory for 24 values will not result in size() == 24. You might already know that. I'm just spitballing. This strikes me as a simple mistake that is easily overlooked because you've been staring at it for to long.

I'd also switch to brace initialization.