ARM Technical Support Knowledge Articles

VARIABLE ORDERING

Applies to: C166 C Compiler

Answer

QUESTION

I need help with the "Keep Variables in Order" option for the C166 Compiler. I have the following declaration:

const unsigned char serialNumDelimeter[6] = {0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55};
const volatile long serialNum = SERIAL_NUMBER;

I expected serialNum to immediately follow serialNumDelimeter in the address space, but this is not the case. In fact, they are reversed. Why is that?

ANSWER

Variable ordering only works with variables, not constants. A solution is to incorporate the constants into a data structure in the proper order.

Article last edited on: 2004-06-07 09:38:12

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential