hi, everyone: Just like the code as below:
1 #include <algorithm> 2 #include <stdio.h> 3 4 #pragma pack(push, 1) 5 typedef struct _test_c 6 { 7 char m; 8 int data[10]; 9 }test_c; 10 #pragma pack(pop) 11 12 int main() 13 { 14 printf(" sizeof test_c is %d \n", sizeof(test_c)); 15 test_c test; 16 for(int i=0; i<10; i++) 17 test.data[i] = 9-i; 18 //int data[10]={9, 8, 7, 6, 5, 4, 2, 3, 1 , 0}; 19 std::sort(test.data, test.data+10); 20 21 return 1; 22 } This code can work on X86, but cause bus error runing on Davinci(My board is DM6446, GCC 3.4) . I know the problem is: std::sort(test.data, test.data+10); test.data is not 4-Bytes aligned. The software I want to port uses structs liking "test_c" a lot. Could anyone give me some advice ? -- Thanks, Zhenfeng Ren _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source