----- Original Message ----- From: Gerhard Fiedler To: Sent: Sunday, June 27, 2004 1:11 AM Subject: Re: [PIC:] Extensions to the PIC18 instruction set > > Before these changes C18/PIC18F encouraged the use of poor programming > > practices because using global variables in access ram was so much more > > efficient than passing arguments and using local variables. > > Isn't that the case with pretty much all 8bit micros? I find myself > routinely having a (hopefully) well thought out set of global variables, > which in this form in general I wouldn't use when programming PC or server > software. > > Gerhard No. 8 bit micros are not the problem, PICs are not the problem. The problem is that the compiler sucks. The compiler is free to allocate RAM in any way it sees fit. It can allocate locals in globally accessible RAM, on the stack, a heap, a linked list. It can even push them out to HD if it wants to. The high level language programmer gets to see the type of scope he wants but at assembler level anything is possible. As a compiler writer you just need to invest the time and energy required to do the job right. You can analyse the source, workout what must be stack relative (reentrant or impossible to predict) and what is well defined and can be allocated statically. Even a lot of the code that initially looks like it must be stack relative can be converted to use a static stack instead of a dynamic stack. The compiler writer just needs to put the effort in. Sorry but adding the extra instructions to compensate for the compiler really does sound like the tail wagging the dog to me. Regards Sergio Masci http://www.xcprod.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics