My program is a bitter large.When I select "keep variables in order" which is located in the option of a project,my program will run normally,though very slowly.Otherwise ,errors will occur.Why? Thanks for your answer.
Keep Variables in Order instructs the compiler to store variables in memory in the same order in which you declare them. By default, variables are not necessarily stored in memory in the same order in which they are declared. Jon
a lot thanks for your reply. Could you tell me what "keep variables in order" effects in program running?Why errors go away when I select it?thanks.
You probably have an error in your code which just happens to be innocuous one way, but disastrous the other; eg, a dodgy pointer is corrupting some RAM - depending on the ordering of your variables in RAM, this might be critical or might not matter at all! Try running it in the simulator and try to spot where the corruption occurs. Uninitialised and/or corrupt pointers would be one thing to look for. Mismatched PUSH/POP would be another. Are you calling functions recursively without specifying them as reentrant? Are you calling any functions via pointers? Do you get any warnings when you build?
Uninitialised and/or corrupt pointers would be one thing to look for. --What are corrupt pointers? Mismatched PUSH/POP would be another. --None.I use C. Are you calling functions recursively without specifying them as reentrant? --None Are you calling any functions via pointers? --None Do you get any warnings when you build? --None
--What are corrupt pointers? If you have a valid pointer and do some math on it, say increment it past the end of the memory block it actually belongs to, you could call it a corrupt pointer. However, this is not a C term. Your pointer either points to valid memory (that is, what you expect it to), junk (someone else's memory), or null (nothing). - Mark
Yes, by "corrupt pointer" I meant a pointer which points where it didn't oughta! It wasn't intended to be a specific 'C' term. Note that, with C51, a pointer specifies both an address and (either implicitly or explicitly) a memory area - DATA, XDATA, etc If the "corrupt" part of a "corrupt" pointer is the memory area, it could end up pointing into the stack - imagine what fun that can be...! You probably need to track this down in the simulator.