Re: Copying a struct to a larger struct?
- From: Barry Schwarz <schwarzb@xxxxxxxxx>
- Date: Wed, 27 Jul 2005 23:28:00 -0700
On 27 Jul 2005 12:32:08 -0700, "hermes_917@xxxxxxxxx"
<kgarrison@xxxxxxxxx> wrote:
>I want to use memcpy to copy the contents of one struct to another
>which is a superset of the original struct (the second struct has extra
>members at the end). I wrote a small program to test this, and it
>seems to work fine, but are there any cases where doing something like
>this could cause any problems?
There is no guarantee that the padding in the common part of the two
structs is the same. It is also possible for the shorter struct to
have padding at the end but in the longer struct there could be an
actual member at the same offset.
<<Remove the del for email>>
.
- Follow-Ups:
- Re: Copying a struct to a larger struct?
- From: Alexei A. Frounze
- Re: Copying a struct to a larger struct?
- References:
- Copying a struct to a larger struct?
- From: hermes_917@xxxxxxxxx
- Copying a struct to a larger struct?
- Prev by Date: Paasing global variables to functions
- Next by Date: Re: Hints on how to migrate from C++ to C
- Previous by thread: Re: Copying a struct to a larger struct?
- Next by thread: Re: Copying a struct to a larger struct?
- Index(es):
Relevant Pages
|
|