• 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: compiler Flags for Code Porting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiler Flags for Code Porting


  • Subject: Re: compiler Flags for Code Porting
  • From: Jens Alfke <email@hidden>
  • Date: Sun, 05 Jun 2011 10:37:57 -0700


On Jun 3, 2011, at 9:26 PM, koko wrote:

I went ahead and did:
if ((__uint32_t)m_handle != INVALID_HANDLE_VALUE)
which sees OK. Any comments?

You’re hardcoding an assumption that this is 32-bit code, for no good reason. So any time in the future you try to port this code to 64-bit, you’re going to end up with potential weird runtime bugs from that line.

Any time you need to cast a pointer to an integer, you should use the standard size_t type, which is guaranteed to be the same width as a pointer.

In this case though, it looks like the proper fix is to declare INVALID_HANDLE_VALUE as a void*, as someone already pointed out.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >compiler Flags for Code Porting (From: koko <email@hidden>)
 >Re: compiler Flags for Code Porting (From: Ron Hunsinger <email@hidden>)
 >Re: compiler Flags for Code Porting (From: koko <email@hidden>)

  • Prev by Date: Re: XCode 3 trashing & error during event broadcast
  • Next by Date: Re: XCode 3 trashing & error during event broadcast
  • Previous by thread: Re: compiler Flags for Code Porting
  • Next by thread: Re: compiler Flags for Code Porting
  • Index(es):
    • Date
    • Thread