This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can anyone provide information on the usage of "#pragma DATA_ALIGN(x,number);", whether it will applicable to local and global variables or global variables alone.



Hi,

I have a file, where the variabes are declared locally and to improve the performance I used _nassert statement. But for doing this memory has to be aligned first so for that I used 

 "#pragma DATA_ALIGN(x,number);", here number means the number by which I aligned the memory.

I have a confusion that can I use this pragma inside the function and made the alignment for local variables alone, because I am using the same variables in many functions. It will be good if someone tell that is this possible or not.

#pragma DATA_ALIGN(x,4);

void fun(void)

{

..............

_nassert((int)x % 8 ==0);

for(i=0;i<m;i++)

a = x[i];

..............

}