• 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: Getting the size of type in the preprocessor.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Getting the size of type in the preprocessor.
      • From: Tim Little <email@hidden>
References: 
 >Getting the size of type in the preprocessor. (From: Tim Little <email@hidden>)
 >Re: Getting the size of type in the preprocessor. (From: "Clark Cox" <email@hidden>)
 >Re: Getting the size of type in the preprocessor. (From: Tim Little <email@hidden>)
 >Re: Getting the size of type in the preprocessor. (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: Getting the size of type in the preprocessor.
  • Next by Date: Re: help with calling a standard line app from terminal
  • Previous by thread: Re: Getting the size of type in the preprocessor.
  • Next by thread: Re: Getting the size of type in the preprocessor.
  • Index(es):
    • Date
    • Thread