|
|||||||||||
Technical Support Support Resources
Product Information |
GENERAL: VARIABLES NOT KEPT IN ORDERInformation in this article applies to:
SYMPTOMSI am using the ORDER compiler directive in my source code and I have declared several variables that I wish to place in memory in the same order. When I examine the symbol table in the map file, they are not kept in the same order that I declared them in. Why? CAUSEThe order is not necessarily taken from the variable declarations, but the first use of the variables. For example, in the following files: header.hextern unsigned char foo; extern unsigned int bar; test.c#include "header.h" unsigned int bar; unsigned char foo; foo is stored in memory first followed by bar. This is because the foo variable is referenced first (by the extern declaration). RESOLUTIONMake sure that in all declarations and externs your variables are declared in the order you require. An alternative solution is to delare a structure containing the variables you wish to keep in order. This behaviour is changed in C166 Version 4.05 and later to take the variable order from the variable declarations. You may download the latest updates from the Keil Website. MORE INFORMATIONLast Reviewed: Friday, July 15, 2005 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.