Re: MFC Porting Issues
Re: MFC Porting Issues
- Subject: Re: MFC Porting Issues
- From: John Stiles <email@hidden>
- Date: Sat, 21 Jan 2006 10:23:26 -0800
Ricky Sharp wrote:
typedef struct
{
BYTE b1[8];
DWORD height;
DWORD width;
WORD w1;
WORD bitDepth;
DWORD d2;
DWORD blockLen;
} IPOD_PICTURE_HEADER;
BYTE = unsigned char
DWORD = unsigned long
WORD = unsigned char
Along with ensuring proper alignment and byte-swapping of the fields,
I strongly suggest the usage of "sized" types that guarantee size
(e.g. UInt16, UInt32, Bool8, etc.) You typically define these types
in some include/import file where they'd be mapped to the appropriate
type that each platform defines.
stdint.h is the standards-compliant way to do this without needing to
make your own header for each platform you build on. (uint32_t and friends.)
This is always necessary for structures that will be populated with
data from some persistent store.
In all fairness, the size of the Windows types is basically carved in
stone. Just about every Win32 app would break horribly if DWORD or WORD
changed size. :)
I agree with your principles, but if we're dealing with a
Windows-centric codebase, it's probably OK as-is.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden