From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Trenton D. Adams" To: "'Andrew Lunn'" Cc: Subject: RE: [ECOS] data alignment issues Date: Thu, 09 Aug 2001 08:49:00 -0000 Message-id: <001c01c120ea$b8d6b740$090110ac@TRENT> References: <20010809165527.G3846@biferten.ma.tech.ascom.ch> X-SW-Source: 2001-08/msg00277.html What about with unions? When I know damn well both platforms have the same size for their primitive data types is it ok to copy an entire union to the buffer? After all, the union will only be the size of the largest data type, and no alignment issues should happen right? -----Original Message----- From: ecos-discuss-owner@sources.redhat.com [ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Andrew Lunn Sent: Thursday, August 09, 2001 8:55 AM To: Trenton D. Adams Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] data alignment issues On Thu, Aug 09, 2001 at 08:43:03AM -0600, Trenton D. Adams wrote: > Why not send structures if it works? After all, if I've tested it and > there isn't any problems, then it's no problem right? Is there any > better way sending data? I suppose I could send the structure one > field at a time What you are say is that it works today with gcc verions X for the target, and MSVC version Y for the host. New version of the compilers may decide to layout the structures differently. Borland may do something different. The next versions of gcc may do something different. MS may change there compiler. At that point, you have to maintain old versions of the tools so you can rebuild your application. What you should do is add some marshelling code. That takes the fields from the structures and places them into an char * array at well known addresses. You can easily write this in a partable way. If you are not interested in portability, you can use the gcc extensions. Andrew