> Do shells suffer UB? I always thought that was a C thing. UB is a standard concept when defining programming languages. Most if not all programming languages have some form of UB or another in some part of the spec. C is special w.r.t to UB in two ways:
- UB is not relegated to corner cases that virtually never happen (like the UB recommended by Jeffrey for sh), as is usually the case. Instead almost all programs in actual use rely on UB during their normal execution and in many cases it's somewhere between hard and impossible to avoid. - Modern C compilers like to optimize code based on the assumption that UB never happens. The combination of the two makes it particularly entertaining. Stefan