Who said anything about a new language? We're talking about a compiler flaw. If CC65 didn't generate awful code we wouldn't even be having this conversation, becauseDRW wrote:In fact, we don't need another high level language either. For me, I can say that I wouldn't switch to another programming language just for one singular feature.
would not be true in the first place.DRW wrote:local variables on the stack require more ROM space and more CPU time
(Of course, C is a lousy language to be using on a 6502 anyway, since the language standard requires all arithmetic be at least 16-bit and pointer arithmetic makes array striping a gigantic pain in the neck. But that's a whole new can of worms.)
...the same way you choose between ZP, main RAM and WRAM? Most assemblers already have automatic allocation; they're just not smart enough to overlap variables that aren't live at the same time.DRW wrote:In C, it should be clear that if the programmer declares a local variable as static, that this one does not get turned into a temp variable.
But how do you distinguish in Assembly whether a .res is supposed to represent a local variable or whether it's a global variable or a local static variable where the value needs to be kept between two function calls?