Re: ISO: help porting C code to 64 bit linux platform
- From: Emmanuel Fleury <emmanuel.fleury@xxxxxxxx>
- Date: Fri, 12 Jan 2007 11:24:11 +0100
Måns Rullgård wrote:
That is a good example of how *not* to write code. *Never*, ever read
or write a struct directly to/from a file. The compiler is free to
insert padding wherever it likes in a struct.
Somehow, I feel you are both right... but you didn't set properly your
initial conditions.
I think that this is true to FORCE variables size when the data are
coming from outside the program. Typically, in the example of Julián the
struct describe the structure of a wav file which should be played on
any type of machine. This is clearly some data imported from outside the
software and on which the programmer has no control.
On the other hand, Måns is right for all the variables which are lying
within the program. It should be define as a coherent data flow without
relying on the size of it.
At last, variables which are exported outside of the software must also
have a known size ('cause they will be imported at some other point).
That's all folks !
--
Emmanuel Fleury | Office: 261
Associate Professor, | Phone: +33 (0)5 40 00 69 34
LaBRI, Domaine Universitaire | Fax: +33 (0)5 40 00 66 69
351, Cours de la Libération | email: emmanuel.fleury@xxxxxxxx
33405 Talence Cedex, France | URL: http://www.labri.fr/~fleury
.
- Follow-Ups:
- Re: ISO: help porting C code to 64 bit linux platform
- From: Måns Rullgård
- Re: ISO: help porting C code to 64 bit linux platform
- References:
- ISO: help porting C code to 64 bit linux platform
- From: lvirden
- Re: ISO: help porting C code to 64 bit linux platform
- From: Jan Panteltje
- Re: ISO: help porting C code to 64 bit linux platform
- From: Emmanuel Fleury
- Re: ISO: help porting C code to 64 bit linux platform
- From: Joe Pfeiffer
- Re: ISO: help porting C code to 64 bit linux platform
- From: Måns Rullgård
- Re: ISO: help porting C code to 64 bit linux platform
- From: Jan Panteltje
- Re: ISO: help porting C code to 64 bit linux platform
- From: Måns Rullgård
- ISO: help porting C code to 64 bit linux platform
- Prev by Date: Re: Linking with librt
- Next by Date: Re: C/C++ Developent Environment
- Previous by thread: Re: ISO: help porting C code to 64 bit linux platform
- Next by thread: Re: ISO: help porting C code to 64 bit linux platform
- Index(es):
Relevant Pages
|