Portability of passing/operating on structures...

Jim Prescott jgp at moscom.UUCP
Thu Nov 3 14:07:15 AEST 1988


In article <2685 at hound.UUCP> rkl1 at hound.UUCP (K.LAUX) writes:
>	If you are trying to get the compiler to automatically generate code
>to copy the fields of the structure, *don't*.  What you can do is ...
>a short loop to copy byte by byte based on 'sizeof (struct)'.

Does ANSI guarantee that this would even work?  I thought that attempting to
read or write holes in structures was undefined (because they could actually
be mapped out of your address space on some implementations).  Thus anything
that tried to look at all sizeof() bytes could fail.  Is this correct?
-- 
Jim Prescott	moscom!jgp at cs.rochester.edu
		{rutgers,ames,harvard}!rochester!moscom!jgp



More information about the Comp.lang.c mailing list