This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Issues with memcpy


Javier Valencia wrote:
Thanks John, it was the problem, uninitialized struct.

To all: i understand now whats happening about aligned stuff, thanks!!

So what is the best way to copy a struct to a byte array without copying empty aligned spaces?
I'm doing now the ugly way, just pointing to each field each time and copying to the buffer.


It's for transmition purposes.

the portable way is to do what you've just described, but also dealing with endianness.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]