this post was submitted on 25 Nov 2025
330 points (99.4% liked)
Programmer Humor
27506 readers
1529 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I worked on a laser seam welder which basically was programmed in a mix of g code and I guess vb??
The fun part was variables could only be numbers between 100 to 999. So let's say you have a sensor and need to verify it's within a certain range. You could set #525 to 10 and #526 to 20 then say #527 = sensor 1 signal. Now lower down you verify it as if(#525 > #527 || #526 < #527){show error}
Now you could create each variable at the beginning with comment of what it was but then have to keep referring to the top to remind yourself what number was what. Or create the variable at first use so it was closer but now it's spread across the document.
I went with first case and just printed out the first 2 pages which listed all the variables.
Before you ask, I talked to the guy who wrote the language and made the system many times he confirmed you couldn't use variable names.
I wonder at what point it would be easier to make a compiler to convert variable names into those numbers
If you did and it was usable across multiple cnc manufacturers you could make a pretty penny.
If I had the necessary insight into these fields to make fixing inefficiencies my job I would
G Code is basically a geometric scripting languge and isn't Turing complete in basic implementations. Every manufacturer pretty much also has their own dialect that is Turing complete.
Gcode with control commands and variables is called, no shit, Macro G Code. It's Turing complete. That form of variable names is normal and is inherited from hardware registers/banks and TTL.
It's not unusual for a save dialog to be labelled Punch as it has a direct lineage from punch tape.
Kind of like assembly and a graphing calculator had an abortion together.
Lol, yeah I've written g-code from 4 different manufacturers and yeah it's a new experience each time.