Re: Getting the size of type in the preprocessor.
Re: Getting the size of type in the preprocessor.
- Subject: Re: Getting the size of type in the preprocessor.
- From: "Chris Suter" <email@hidden>
- Date: Wed, 3 Sep 2008 11:47:14 +1000
On Wed, Sep 3, 2008 at 11:31 AM, Steve Checkoway
<email@hidden> wrote:
On Tue, Sep 02, 2008 at 07:35:49PM -0500, Tim Little wrote:
> Thanks, I had completely forgotten those existed now. MS doesn't
> support them in VS, but they have alternatives that are easy to use.
I think the thing to do is use the standard types and for compilers
which don't support standards (basically just VS, right?) define the
types yourself.
On a semi-related note, you can perform compile time checks on sizes of types by doing this:
#define CHECK3(x, line) typedef char check ## line[(x) ? 1 : -1];
#define CHECK2(x, line) CHECK3(x, line)
#define CHECK(x) CHECK2(x, __LINE__)
CHECK(sizeof(int) == 4)
You'll get a compiler error if that ever wasn't true.
-- Chris
_______________________________________________
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