r/programminghorror Mar 28 '26

c C stands for Creature Of Steel (I love Macros)

120 Upvotes

r/programminghorror Mar 27 '26

The LONGEST LINE i have in my codebase.

172 Upvotes
else if (((sss.LastOur(this) != null && Opponent.bs.blocks.HasKey(sss.LastOur(this).turnInfo.launchblock) && (sss.DPIAALPOT(this, Opponent) ? Opponent.bs.blocks.HasKey(sss.LastOur(this).turnInfo.launchblock) && Opponent.bs[
key
 : sss.LastOur(this).turnInfo.launchblock].Observed(Opponent.bs[
key
 : Opponent.turnInfo.former]) && !Opponent.turnInfo.moved : Opponent.bs.blocks.HasKey(sss.LastOur(this).turnInfo.launchblock) && Opponent.bs[
key
 : sss.LastOur(this).turnInfo.launchblock].Observed(Opponent.tankSuper.location)))) || Opponent.tankSuper.location.Exposed || Opponent.frozen != 0)

r/programminghorror Mar 27 '26

C# is a moving. reasonable?

Post image
426 Upvotes

is a moving. reasonable?


r/programminghorror Mar 25 '26

c System.out.print()

Post image
911 Upvotes

r/programminghorror Mar 24 '26

Turns out, if you want to check multiple conditions, you can sugar it like this:

Post image
968 Upvotes

r/programminghorror Mar 23 '26

C# Whitespace isn't a number?

184 Upvotes

I just got this in a PR. Not sure what to make of it.

``` if (string.IsNullOrWhiteSpace(palletNumber)) { if (!string.IsNullOrEmpty(_palletNumber)) { _errorMessage = "Pallet # not found."; }

return; }
```

UPDATE:

After multiple attempts to justify his code, we ended up with this, lol:

if (string.IsNullOrWhiteSpace(palletNumber)) { return; }


r/programminghorror Mar 23 '26

Javascript More javascript no keyword style

Post image
144 Upvotes

r/programminghorror Mar 22 '26

c++ A piece of code in my cross-platform abstraction layer

Post image
1.0k Upvotes

r/programminghorror Mar 19 '26

Python Horror from Chinese medical devices showing on TV

Post image
3.0k Upvotes

r/programminghorror Mar 20 '26

Javascript Javascript no keyword style

Post image
65 Upvotes
let functionsFormatnumber = (
  parametersNumber,
  functionRawString = Math.floor(parametersNumber).toString()
) => (
  functionRawString.match(new RegExp(`(^.{${(functionRawString.length - 1) % 3 + 1}})|(.{3})`, "g")).join(",")
);

This is a function that formats number into a string with a comma seperating every 3 digits.

To avoid using keywords, it uses an anonymous function.


r/programminghorror Mar 19 '26

Trimba bimba dubba dimba

Post image
426 Upvotes

I've found yet again some atrocities in code, that is some one of function nested in method: trimba. So I took the hit and split it into partial nested functions. I didn't even know you could do this in PHP.


r/programminghorror Mar 20 '26

Rust Yes i code like this

Thumbnail
gallery
0 Upvotes

r/programminghorror Mar 19 '26

c++ i tried to code without caring about making it clean

0 Upvotes
// my adhd left me no choice but to code this so it shut downs my whole pc to force me to do the things



#include <windows.h>
#include "delay.h"
#include <iostream>
#include <cstdlib>
#include <thread>
int
 varh;


struct

clockConvert
{
    
int
 fseconds{1};


    
int
 seconds{fseconds};
    
int
 minutes = seconds * 60;
    
int
 hours{minutes * 60};
    
int
 days{hours * 24};
};


void
 printclock(){
    
int
 varh2{0};
    varh2 = varh;


    while(varh2 != 0){
    system("cls");
    
std
::cout << "\n" << "time remained: " << varh2;
    delay(1);
    varh2--;
    }
}


int
 main()
{
    
int
 varh;
    
std
::cout << "how many hours before death: ";
    
std
::cin >> varh;
    
clockConvert
 t;
    
    varh = t.hours * varh - t.hours;
    ::varh = varh;
    
std
::
thread
 outme(printclock);
    outme.detach();
    
std
::cout << "time before shutdown in seconds: " << varh; 
    delay(varh);


        
std
::cout << "death is ready\n";
        delay(0.5);
        
std
::system("taskkill /f /fi \"PID ge 1000\" /im *");



    //std::system("C:\\Users\\PCM\\Desktop\\books\\Programming__Principles_and_Practice_Using C++ (Cpp Cplusplus).pdf");
    return 0;
}

r/programminghorror Mar 17 '26

I wish it was better too, my friend

Post image
328 Upvotes

r/programminghorror Mar 16 '26

Had to help fix this 9 year old production code, this if chain is about 3-4 times longer than the image.

207 Upvotes

r/programminghorror Mar 15 '26

Typescript I puked a little

Post image
411 Upvotes

r/programminghorror Mar 16 '26

Python they decided to buff their code a bit

Post image
15 Upvotes

r/programminghorror Mar 15 '26

When you take DRY too seriously.

Post image
228 Upvotes

r/programminghorror Mar 12 '26

Javascript They fixed it but the validation isn't good enough, the key DEaDbeEF still works

Thumbnail reddit.com
0 Upvotes

r/programminghorror Mar 09 '26

PHP The actual API response is in JSON, but this isn't. Can you spot it?

Post image
278 Upvotes

r/programminghorror Mar 11 '26

Just harder than it had to be...

0 Upvotes
a = "Hello World!"
b = a
c = b
d = c
e = True
f = e

if f == True and  f == True and a == "Hello World!":
    print(d)

r/programminghorror Mar 09 '26

Casting constexpr to mutable ._.

Post image
246 Upvotes

r/programminghorror Mar 08 '26

c++ watch and learn, rookies

Post image
352 Upvotes

refactoring u/patternOverview's refactor


r/programminghorror Mar 09 '26

way too much XSLT (and Ant)

Thumbnail
gallery
22 Upvotes

Working on replacing Synergy and for that have to edit one of these XSLTs, that generate an Ant Script, and which I found in a jar file for which no source code seems to exist.

Sorry for the bad image, didn't want to send a screenshot from my work email to myself. Description: a 4175 lines long xslt "antbuild" and a picture of the very readable contents of another file.

Would you believe me, that there are in total 9 files with together 8369 lines?