Re: Copying a struct to a larger struct?



"Barry Schwarz" <schwarzb@xxxxxxxxx> wrote in message
news:g7uge1pv97iu2j9faooaguv3234gafc8ok@xxxxxxxxxx
> On 27 Jul 2005 12:32:08 -0700, "hermes_917@xxxxxxxxx"
....
> There is no guarantee that the padding in the common part of the two
> structs is the same.

If my memory serves me, the standard gurantees that. But, I'd prefer to turn
that common part into a type used inside both structs. memcpy() will be able
to do bad things silently...

Alex


.



Relevant Pages

  • Re: structure layout question
    ... which means one cannot rely on the exact layout anyway, ... The standard's wording guarantees that two structs defined with the same ... as you access only common members, ...
    (comp.lang.c)
  • Re: How to extract bytes from a long?
    ... Two structs with a common starting point. ... > union Example { ... >> I didn't know grammar of American and British is different. ...
    (comp.lang.c)
  • Re: Transparent bridges (a. k. a. HUB-to-PCI bridges)?
    ... I'm no John Kennedy, nor even John Baldwin, but I'll give this a shot. ... A host-PCI bridge is typically part of the "southbridge" chip of modern ... careful programming in C lets you create several closely-related structs for ... The most common example of this would probably be the protocol-independent ...
    (freebsd-current)
  • Re: Sending data to windows
    ... It is is also common in Win32 programming where many Structs contain a ... languages that can vary the pack size. ...
    (microsoft.public.vb.general.discussion)
  • Re: two revision levels are incompatible??
    ... instead of manually adding the padding, i would use explicit padding (ie use ... > need that for other structs in the app. ... >> before the DeviceIoControl call. ...
    (microsoft.public.win32.programmer.kernel)