sizeof(aStruct) in Xcode 4
sizeof(aStruct) in Xcode 4
- Subject: sizeof(aStruct) in Xcode 4
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Tue, 21 Jun 2011 15:39:30 -0400
- Acceptlanguage: en-US
- Thread-topic: sizeof(aStruct) in Xcode 4
I am porting a legacy project from Xcode 3.2.6 to Xcode 4.0.2. I am using LLVM 1.7 in the former and LLVM 2.0 in the latter. Also using LLDB. My computer is a 64-bit Mac Pro but the target is set to 32-bit Intel and Snow Leopard for legacy reasons.
The problem is with two structs:
struct AA { int n; double val; };
struct BB { short ss, tt; double val; };
sizeof(AA) and sizeof(BB) both come out as 16 even though they "should" be 12. I pack sequences of these structs into NSData objects (at which point they are 12 bytes) and pass them (NSPipe) to some subprocesses (NSTask) running independently. As such, sizeof(struct …) is important in the conversion of NSData to something else.
Clearly, I am confused by the proliferation of int types and unsure what the recommended practice should be to avoid these errors.
Any tips?
Thanks in advance.
|
_______________________________________________
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