Question about -ansi flag, and different size of struct from C and C++

Oleg Ivanov Belinus at
Mon Dec 15 15:34:15 UTC 2003

Ralf Corsepius пишет:

>On Mon, 2003-12-15 at 15:18, Oleg Ivanov wrote:
>>   Thanks a lot!
>>   Yes, I also see #pragma warning: ignoring pragma: even if I compiling 
>>with or without -ansi flag.
>>   And another thing, I compile code under two targets Motorola 68360 
>>and 860.
>>   In one point compiler aligned all struct to 4, in other every struct 
>>   That mean size of struct
>>   struct dummy {
>>      int var1;
>>      short var2;
>>      int var3;
>>      short var4;
>>   }
>>   on motorola 68360 will be 12 byte, and on 860 - 16 byte...
>>Is it also target dependent ?
>Yes, it is.
>But what is your actual problem? Size (eg. allocating large arrays), or
It's more IO, but and size too.
 From Rtems I controle hardware that accept about 30  packets(each with 
fix length) with several(to 32) commands with parameters(full packet 
send even all or only one command is set), so I think that easy way to 
handle this zoo is to make a struct to each packet. But as I say got 
this problem, size changes and command rejected, and also packet work 
only from C, from C++ it not work. It's work only when I ommit -ansi flag.

More information about the users mailing list