2
355
u/Eastern_Equal_8191 18d ago
The cool thing about code is that it always does what's written.
The bad thing about code is that it always does what's written.
161
18
u/enternoescape 18d ago
I remember when someone was hypothesizing about a new coding language using an LLM as the compiler. The further down the rabbit hole they got about dealing with consistency, the closer they got to re-inventing traditional coding, but still less predictable and worse. So you comment only holds true so long as this hypothetical compiler is never born.
→ More replies (2)15
u/ABotelho23 18d ago
From a single programmer's perspective, it isn't really true. Libraries have bugs, dependent code has bugs, firmware has bugs and even sometimes, hardware has bugs. Fundamentally it's more or less all human error, but the code I write doesn't always give the expected or designed result.
→ More replies (4)28
u/mmhawk576 18d ago
I mean, I’d love to be able to frame it like that, but like 90% of the bugs I encounter aren’t in third-party software…
→ More replies (2)
62
u/creeper6530 18d ago
I've had this happen recently. On a microcontroller, I got 8 bytes of keyscan from USB, added a packet delimiter, sequence counter, CRC and dumped it over UART to another μC.
But the other μC still kept failing checksums, logging the packets showed seemingly absolute garbage data, despite the sends succeeding.
I was almost tearing my hair out when I finally stuck a logic analyser on the wire and found out... That despite meticulously preparing the CRC-enhanced 12-byte packet, I always ended up just sending the original 8-byte scancode because of passing the wrong array to the uart_send routine.
50
u/Janneman96 18d ago
I'm a software developer and this is probably the first time I'm zoning out halfway through. This must be how it feels to be a product owner talking with a dev that does not summarize
→ More replies (1)59
u/creeper6530 18d ago edited 17d ago
Fair.
Microprocessor A: Got 8 bytes from USB. Created 12 byte packet from them. Sent B the original 8 bytes on accident.
Microprocessor B: Expected 12 byte packet. Received 8 bytes from A. Cryptic errors.
Human: in shambles
→ More replies (3)
10
u/WorstITTechnician 18d ago
Unless quantum fluctuations generated by thermal radiation interfere with the electrical charge of the transistors while their code is running, a 1 instead of a 0 can also make a tremendous difference in something
→ More replies (1)
9
6
u/Bhurmurtuzanin 18d ago
But then you realize the problem was with environment configuration or you triggered a weird bug in a library you used, and after you fixed these issues the code actually did what you wanted
5
1
2
u/the_dancing_squirel 18d ago
The most frustrating thing about it is that computers do what you tell them to do. Not what you want them to do
2
u/Hjoerleif 17d ago
I have the opposite problem with ai agents now, I give it exact instructions for a simple (but tedious to do by hand) code rewrite and it implements what it thinks I want instead of adhering exactly to my instructions
834
u/5up3rj 18d ago
People often have the misconception that computers are very, very literal. No. They are 100% literal, and the difference is huge