To: | |
---|---|
Subject: | Re: [ts-7000] Re: Warning: Floating point format bug encountered using arm-linux-gcc-3.3.4 |
From: | "Don W. Carr" <> |
Date: | Sun, 22 Oct 2006 21:42:08 -0500 |
Also be very carefull with structures sent over the network, even if the types in the structure do not have problems with byte ordering (like floating points). You can NEVER send structures in binary format because compilers often add byte padding to guarantee arrays of structures will be alligned properly (space / time tradoff), thus the exact same structure on two different platforms could be even a different size. Even the same processor architecture, but different compiler. Here is my favorite example: struct mystruct { char c; double d; }; If you do a sizeof(mystruct), depending on the platform and compiler, you will get either 9, 12, or 16 bytes. In the case of 9, the compiler packs the structure as small as possible, then copies the double to an alligned memory space before accessing it, in the case of 12, doubles must be alligned on a 4 byte boudry (x86) and the compiler uses byte padding to guarantee that arrays of structures are all properly alligned, in the case of 16, doubles must be alligned on an 8 byte boundry (Sparc) and the compiler uses byte padding. On 10/22/06, arm.user <> wrote:
|
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | Re: [ts-7000] BUS PC/104 - C/C++, Don W. Carr |
---|---|
Next by Date: | [ts-7000] newbie questions re TS-7400: WLAN etc, Rob Barris |
Previous by Thread: | [ts-7000] Re: Warning: Floating point format bug encountered using arm-linux-gcc-3.3.4, arm.user |
Next by Thread: | [ts-7000] TS-7400, max232, and me...., larstorben |
Indexes: | [Date] [Thread] [Top] [All Lists] |
Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU