On Thu, 23 Oct 2008, Tamas Rudnai wrote: > > Many compilers avoid the standard 'stack frame' linkage stuff for leaf > > functions (those which do not call any other functions). This can be a > 'big > > win' for performance on some architectures. > > Yes, they are thinking upfront of me (me as a developer), so that they > replace all the variables to 'static' variables - so that is no longer > needed to use FSR calculations and therefore stack manipulation for locals. > That leads to other issues as well, like RAM usage (needs more RAM) and > sometimes very nasty issues like what if I do something different in the > next version of my firmware? So that the compiler is no longer able to > optimise the functions in that way aming bigger code or much slower than was > it before or because all the variables becoming "normal locals" when there > was an initialisation problem in the firmware that was not determined before > it brakes the whole project just because of a small update... These things > lead to the problems of "it was working before, and I did not change that > routine, only put this or that which is irrelevant but now it does not work > any more". > > Because of these things, personally I do not think if that is generally a > good idea from the compiler to make optimisation like that by itself - if > compiler lets the developer to create static locals, and if there are other > techniques that can be used to reduce performance issues and all the side > effects known by the developer, then it is ok. But I do not like when some > artificial intelligence decides how to write a fimrware. > I disagree. A high level programming lanugage is just a way for you to specify what you want a computer to do. A good language will make it easier for you to do this and at the same time allow the compiler to generate the best possible code. Kind of like you telling an assembler programmer what you want the computer to do and then letting the programmer get on and write the best code he can. If you have an issue with a section of the generated code then I would suggest that either the language was not able to convey the importance and constraints necessary of that section or the programmer did not do a good enough job of telling the compiler. Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist