r/shittyprogramming • u/thisisamirage • Dec 10 '13
r/shittyprogramming • u/mr_smartypants537 • Apr 18 '17
Hey guys I made a python interpreter in python
while 1:
eval(input())r/shittyprogramming • u/form_d_k • Sep 19 '22
A Few Years Ago the Hack Language Reference Removed This Critical Content; Posting To Keep Knowledge Alive
r/shittyprogramming • u/flukemmviii • Sep 21 '16
Whats the Windows equivalent of my MAC address.
Moving my internet to windows need help thanks
r/shittyprogramming • u/ReckoningReckoner • Jul 16 '15
I literally used an "else if" on the line before
r/shittyprogramming • u/Theemuts • Jan 16 '15
Moved ~/.local/share/steam. Ran steam. It deleted everything on system owned by user.
r/shittyprogramming • u/Hook3d • Nov 07 '19
Why can't Alice and Bob work out their relationship and stop sending letters?
r/shittyprogramming • u/cosinezero • Aug 20 '15
super approved Do I have to kill the running process to make sure my classes get their inheritance?
r/shittyprogramming • u/[deleted] • Feb 28 '23
I've developed a new graphics mode for Linux
r/shittyprogramming • u/erinyesita • Jan 30 '20
Could God create a programming language so esoteric that He Himself could not parse it?
...or Goddess, Machine Overlord, etc.
r/shittyprogramming • u/minimaxir • Jan 23 '18
The real cause of global warming is Python.
r/shittyprogramming • u/catsmore2thanu • Nov 02 '17
If The World Was Created By A Programmer
r/shittyprogramming • u/[deleted] • Jan 17 '17
super approved How did they code Notepad if they didn't already have Notepad to type the code into???
r/shittyprogramming • u/[deleted] • May 29 '15
I was looking for a new LinkedIn background...Wild Shitty Programming Appeared!!!
r/shittyprogramming • u/combatdave • Feb 24 '15
Did anybody else know that Python includes a full C++ compiler?
r/shittyprogramming • u/Monkey_Adventures • Feb 11 '21
Why Microsoft Word is the best IDE
r/shittyprogramming • u/readball • Mar 22 '23
Anyone else started wondering how is this going to generate a Date?
r/shittyprogramming • u/missblit • Dec 31 '14
super approved Can code be too fast?
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();
}It uses threads (fast!)
It uses assembly (so fast!)
The uses the volatile keyword to indicate code that's so fast it's volatile
The assembler syntax is GAS, meaning the code has enough energy that it's not a solid, liquid, or intel.
emplace_back is super fast because it uses C++ move semantics.
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 • u/JipsAndJools • Oct 05 '15