Hello with #pragma DATA_ALIGN(VaribleName , 8); i cann align a global varible. But i have to align a local varible how do i do that? Fabian
Align of Data for C6713
Started by ●November 11, 2004
Reply by ●November 11, 20042004-11-11
Fabian wrote:> Hello > with #pragma DATA_ALIGN(VaribleName , 8); i cann align a global varible. > But i have to align a local varible how do i do that? > > FabianHow local a variable? If you mean one declared inside a function then it goes on the stack, and getting data alignment would be difficult. If you mean local to your file then you can declare it static: static int myStaticVar[8]; will show up within the file but will not become a global symbol for linking. You may be able to declare it static within a function, as well -- in that case the variable scope will be inside the function but it will be allocated a permanent spot in memory. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●November 11, 20042004-11-11
Don't think that can be done by any pragmas. Local variables are put on the stack and it is not known at compile time what the stack alignment would be at any function call . But if it necessary you can use the trick of creating an aligned buffer(of smaller size) from a non-aligned buffer (of larger size). Regards Piyush adler24@gmx.de (Fabian) wrote in message news:<84bca505.0411110122.7fb72e0@posting.google.com>...> Hello > with #pragma DATA_ALIGN(VaribleName , 8); i cann align a global varible. > But i have to align a local varible how do i do that? > > Fabian