I worked at Honeywell as an intern during the summer of 2005 in Albuquerque, New Mexico. After I finished everything they'd prepared for me during the first two weeks, they gave me something more difficult. They had a contract for the Basic Input / Output Controlled (BIOC) for the C130-J airplane. The BIOC-builder was built using C code. However, this C code was not written by a rational human being, an irrational human being, or any kind of human being at all, but a compilation process from some other language no one had access to, could remember, or do anything with.
The BIOC worked properly (after being built by the BIOC-builder), but Honeywell was spending something like 200k / year with Sun on a lease for a Sun microcomputer to compile this ONE application. The software team would often times modify the BIOC after it was built, since it was basically impossible for anyone to change the BIOC-builder. This was expensive, time consuming, and sucked big time for applying this ever-increasing sequences of patches.
Sounds like a good project for a summer intern, right?
The nice thing about the Sun compiler Honeywell used was that it zero padded all arrays Like, every single memory allocation routine would return you a bunch of zero'd out memory, even if you specifically did not ask for that. The PC compiler took a much more literal, and less wasteful, approach of only giving you zero'd memory when you'd ask for it. The machine-generated code never asked for memory to be allocated with zeros, which meant every single string copy, memory copy, or pretty much everything that operated over an array died. So I had to rewrite all memory allocation. After I did this, and got to be really good with Valgrind, I changed TWO lines of code that had to do with byte order indexing differences between the Sun and PC, generated the BIOC-builder, generated a BIOC, passed all avionics related tests, had a bunch of high fives and left early to drink a beer, or seven, to celebrate. We got the rest of the team set up later that week, or the week after.
This would have been better in Rust. This would have been even better if the corporate overlords, and all the engineers involved, pushed to understand something they heavily depended on. Yes, they had work-arounds. Yes, those work-arounds sucked big time.
Machine generating code lends itself to a lack of understanding. Sometimes that's desirable, such as the fact that I REALLY don't understand any kind of assembly very well, but can (could?) write C and C++ all right. Sometimes that's not, like when you're paying Sun 200k / year in 2005 dollars for a machine to maintain super critical code that no one understands, and no one can work on.
Honeywell offered me a job. I hate cubicles though, so I turned it down. I was like 22, and if I'd been thinking properly at that time, I'd have countered with an offer to be a contractor.