r/programminghorror • • Oct 17 '26

Oh yeah my bad

Post image
973 Upvotes

32 comments sorted by

288

u/Mr_Cursedd Oct 17 '26

штдшsize_t

111

u/Right_Ear_2230 Oct 17 '26

56

u/TheDiBZ Oct 17 '26

why is this in japanese… cpp reference man…

52

u/Right_Ear_2230 Oct 17 '26

Is for the utf32 string

49

u/shponglespore Oct 17 '26

Because they can't use English to demonstrate multi-byte characters?

7

u/nrmu9 Oct 18 '26

The joke flew right over your head

90

u/FloatingGhost Oct 17 '26

this is a verified T_PAAMAYIM_NEKUDOTAYIM moment

19

u/arielif1 Oct 17 '26

wrong file encoding? that's the only thing i can imagine being wrong here, especially since the same Cyrillic character appears twice

36

u/Mucksh Oct 17 '26

What is the horror. Encoding issues on the file or that there is a custom function to return a string length

4

u/TheBritishSyndicate Oct 19 '26

the error had an issue with ‘size_t’ and when referencing the same thing later in the same error changed ‘size_t’ to ‘штдшsize_t’

8

u/uglycaca123 Oct 18 '26

the solution is to define штдшsize_t as an alias for size_t, obviously /j

32

u/TechnoByte_ Oct 17 '26

Rule 1:

All posts MUST show terrible code. There are no exceptions.

40

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Oct 17 '26

Moderator burnout… I should get more mods.

10

u/AnArmoredPony Oct 18 '26 • Heartwarming

well it's C++ so it qualifies

0

u/[deleted] Oct 18 '26

[deleted] — view deleted comment

3

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Oct 18 '26

I would post a good programming horror that my professor gave, but I can't share course content for academic integrity reasons and also because I don't want to dox myself.

2

u/Rainmaker526 Oct 18 '26

Putting non printable characters before your type definition is pretty terrible, though likely intentional.

4

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Oct 20 '26

Isn't that Cyrillic? Though why the hell are they showing up in one place, but not the other? One font missing the characters?

2

u/Rainmaker526 Oct 20 '26

The editor is using a font without support for Cyrillic characters.

Too lazy to type the full explanation, so here's an AI summary that explains it. The only thing is that I propose OP did this intentionally, rather then accidentally.

--
This is a classic example of a font-fallback illusion combined with a keyboard layout mishap:

  1. The Keyboard Swapping Mishap: While typing, your system keyboard layout accidentally switched to a Russian/Cyrillic layout. You intended to type inline size_t, but when you pressed the keys for i-n-l-i, your keyboard registered the Cyrillic keys ш-т-д-ш. You then realized the mistake or swapped back, and finished typing size_t normally.
  2. Font Fallback Behavior: Your code editor uses a fixed-width programming font that doesn't natively contain standard visual glyphs for Cyrillic characters like ш, т, or д. To prevent showing broken empty rectangles (called "tofu") or question marks, your modern editor automatically "borrows" lookalike characters from a fallback system font.
  3. The Coincidence: Because of how text scales and renders in this fallback font, the characters штдш are being forced to visually squeeze and mask themselves right on top of where the compiler reads the hidden bytes, mimicking the visual letters si.

--

-8

u/Right_Ear_2230 Oct 17 '26

New rule: stop.

-6

u/tangerinelion Oct 17 '26

A function called char_count taking a string is terrible. String already does that, no need for a while loop...

9

u/shponglespore Oct 17 '26

Depends on what you mean by "character".

6

u/Kuddel_Daddeldu Oct 17 '26

Consider the string being a Shakespeare play... Does the function count Viola and Cesario as one or two characters in The Twelfth Night?

4

u/_usr_nil Oct 17 '26

for the love of God don't fucking use windows types, holy shit

2

u/Cautious_Implement17 Oct 22 '26

is the LPCWSTR in the room with us now?

2

u/CodingChris Oct 19 '26

Windows types?

0

u/_usr_nil 29d ago

the stuff that comes with that aberration of Win32.h or whatever WinApi which could break portability, just stick with stdint.h and whatever other std for other types, it's just common sense and headache prevention against winslop incredible decision making

1

u/CodingChris 29d ago

I just don't see any Windows.h types in the image.

0

u/_usr_nil 29d ago

intellisense

2

u/KlyptoK Oct 19 '26

Is a windows header overriding the C++ standard size_t?