• 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: Different structure sizes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different structure sizes


  • Subject: Re: Different structure sizes
  • From: "Justin C. Walker" <email@hidden>
  • Date: Mon, 12 Dec 2005 20:12:49 -0800


On Dec 12, 2005, at 17:41 , david tay wrote:

Hi,

I have compiled some code that uses data structures such as
typedef struct PadState {
	UInt8	num;
	UInt8	myData[7];
} PadState;

and
typedef struct DeviceSettings {
	PadState	myState;
	UInt32		myOtherStuff1;
	UInt32		myOtherStuff2;
	UInt8		myByteSizedData1;
	UInt8		myByteSizedData2;
	UInt8		myByteSizedData3;
	UInt8		myByteSizedData4;
} DeviceSettings;

In a simple user space test app, sizeof(PadState) gives 8 and sizeof (DeviceSettings) gives 20 when inspecting things using gdb.

When I use the same constructs in a kext, and look at things with remote gdb,
sizeof(PadState) gives 6 and sizeof(DeviceSettings) is 20.



Both the test app and kext were compiled using gcc 4.0.1 using XCode 2.2 with MacOSX10.4u.sdk.


Is this caused by a bug in gdb? Or should I be concerned that this could be a real problem.

In the absence of a definitive answer, can't you just have the test app and the kext each print the 'sizeof' value to see what's really going on?


Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for General Semantics
--------
When LuteFisk is outlawed,
Only outlaws will have LuteFisk
--------


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Different structure sizes (From: david tay <email@hidden>)

  • Prev by Date: gxx_personality_v0
  • Next by Date: Xcode 2.2 Hanging when changing page size of a model view
  • Previous by thread: Different structure sizes
  • Next by thread: Re:Different structure sizes
  • Index(es):
    • Date
    • Thread