r/shittyprogramming • • Dec 10 '13

My buddy is a phenomenal programmer, but really needs to learn how to write commit messages...

Post image
313 Upvotes

r/shittyprogramming • • Apr 18 '17

Hey guys I made a python interpreter in python

311 Upvotes
while 1:
  eval(input())

r/shittyprogramming • • May 25 '15

if(true) { } else { }

Thumbnail
imgur.com
310 Upvotes

r/shittyprogramming • • Sep 19 '22

A Few Years Ago the Hack Language Reference Removed This Critical Content; Posting To Keep Knowledge Alive

Post image
309 Upvotes

r/shittyprogramming • • Sep 21 '16

Whats the Windows equivalent of my MAC address.

309 Upvotes

Moving my internet to windows need help thanks


r/shittyprogramming • • Jul 16 '15

I literally used an "else if" on the line before

Post image
309 Upvotes

r/shittyprogramming • • Jan 16 '15

Moved ~/.local/share/steam. Ran steam. It deleted everything on system owned by user.

Thumbnail
github.com
309 Upvotes

r/shittyprogramming • • Nov 07 '19

Why can't Alice and Bob work out their relationship and stop sending letters?

308 Upvotes

r/shittyprogramming • • Oct 01 '19

i'm sure it will always work fine

Post image
308 Upvotes

r/shittyprogramming • • Apr 15 '19

this good code? Is

Post image
308 Upvotes

r/shittyprogramming • • Aug 20 '15

super approved Do I have to kill the running process to make sure my classes get their inheritance?

307 Upvotes

r/shittyprogramming • • Feb 28 '23

I've developed a new graphics mode for Linux

306 Upvotes

r/shittyprogramming • • Jan 30 '20

Could God create a programming language so esoteric that He Himself could not parse it?

306 Upvotes

...or Goddess, Machine Overlord, etc.


r/shittyprogramming • • Oct 28 '19

A friend's CS assignment.

Post image
306 Upvotes

r/shittyprogramming • • Feb 28 '19

<wrong_sub>this</wrong_sup> BRUH

Post image
306 Upvotes

r/shittyprogramming • • Jan 23 '18

‪The real cause of global warming is Python.‬

Post image
306 Upvotes

r/shittyprogramming • • Nov 02 '17

If The World Was Created By A Programmer

Thumbnail
blog.toggl.com
306 Upvotes

r/shittyprogramming • • Jan 17 '17

super approved How did they code Notepad if they didn't already have Notepad to type the code into???

305 Upvotes

r/shittyprogramming • • May 29 '15

I was looking for a new LinkedIn background...Wild Shitty Programming Appeared!!!

Thumbnail
imgur.com
305 Upvotes

r/shittyprogramming • • Feb 24 '15

Did anybody else know that Python includes a full C++ compiler?

Thumbnail
imgur.com
305 Upvotes

r/shittyprogramming • • Feb 11 '21

Why Microsoft Word is the best IDE

Thumbnail
youtu.be
304 Upvotes

r/shittyprogramming • • Mar 22 '23

Anyone else started wondering how is this going to generate a Date?

303 Upvotes

r/shittyprogramming • • Dec 31 '14

super approved Can code be too fast?

303 Upvotes

Sometimes when I'm programming something weird will happen. Then when I slow it down to get a closer look at it it won't act weird at all.

For example, take this hyper-optimized "Hello, World!" program:

#include <iostream>
#include <string>
#include <thread>
#include <vector>
void hello_runner(char c) {
	asm volatile(
		"movq $1,      %%rax ;"
		"movq $1,      %%rdi ;"
		"movq %[addr], %%rsi ;"
		"movq $1,      %%rdx ;"
		"syscall"
		:
		: [addr] "r"(&c)
		: "%rax", "%rdi", "%rsi", "%rdx", "memory"
	);
}
int main() {
	using namespace std::literals;
	const std::string hello = "Hello, World!\n";
	std::vector<std::thread> threads;
	for(char c : hello)
		threads.emplace_back(hello_runner, c);
	for(std::thread &t : threads)
		t.join();
}
  1. It uses threads (fast!)

  2. It uses assembly (so fast!)

  3. The uses the volatile keyword to indicate code that's so fast it's volatile

  4. The assembler syntax is GAS, meaning the code has enough energy that it's not a solid, liquid, or intel.

  5. emplace_back is super fast because it uses C++ move semantics.

  6. I compiled the code with -Ofast

Now when I run this I get nonsense like "eHlol ,oWrl!d", whereas if I step through it in GDB it works flawlessly.

As far as I can tell my code is perfect, as it uses all C++14 best practices, so what's going on?

Is the code so fast that it's overheating? Is the fact that I'm "observing" the code by stepping through it relevant on a quantum level?


r/shittyprogramming • • Oct 05 '15

Who needs encryption algorithms when you have the virtually unbreakable Bogosort?

Post image
302 Upvotes