• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: struct size?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct size?


  • Subject: Re: struct size?
  • From: philippe wicker <email@hidden>
  • Date: Sat, 11 Mar 2006 20:32:46 +0100


On Mar 11, 2006, at 7:50 PM, Erick Tejkowski wrote:

Can anyone help me figure out why SizeOf reports that the size of a ScheduledAudioFileRegion struct is 96 bytes, but when I add the numbers up in my head, it comes to 92? I've appended sizes to each struct member below to show you how I came up with 92. Any ideas what I am calculating wrong?

You're simply not calculating the same way as the C++ compiler does :) Your struct contains 8 bytes length fields (mStartFrame and some other fields within AudioTimeStamp) so it has an alignment constraint of 8. 92 is not evenly divisible by 8, 96 is. So the compiler allocates a size of 96 bytes to your struct. There exist some pragmas that tells the compiler to use different alignment constraints but I don't remember what they are.



Thanks, Erick


  struct ScheduledAudioFileRegion {
      AudioTimeStamp   mTimeStamp;//64
      ScheduledAudioFileRegionCompletionProc  mCompletionProc; // 4
      void *     mCompletionProcUserData;//4
      struct OpaqueAudioFileID *mAudioFile; //4
      UInt32     mLoopCount; //4
      SInt64     mStartFrame; //8
      UInt32     mFramesToPlay; //4
  };

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: struct size?
      • From: Erick Tejkowski <email@hidden>
References: 
 >struct size? (From: Erick Tejkowski <email@hidden>)

  • Prev by Date: struct size?
  • Next by Date: Re: struct size?
  • Previous by thread: struct size?
  • Next by thread: Re: struct size?
  • Index(es):
    • Date
    • Thread