• 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: uint64_t error and architecture targets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uint64_t error and architecture targets


  • Subject: Re: uint64_t error and architecture targets
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 11 Feb 2011 11:14:36 -0800

On Feb 11, 2011, at 06:52, Andreas Grosam wrote:

> I just wanted to suggest a more proper way to do this kind of stuff.
>
> Well, at least here, what's apparently wrong with C++ makes the code robust, maintainable and easily understandable. And don't think the compiler expands this to a whole bunch of machine statements - it's as small as it can be. On the other hand, using the assignment with a constant -1 can lead quickly to broken code.

I wasn't being serious, so no real offense to C++ was intended.

However, I do want to acknowledge the subtlety of Clark's post. (I'm crediting him with subtlety, even if that wasn't what he was aiming for.) The C construct:

	uint64_t y = -1;

is utterly crazy, but it's *spec-mandated* craziness -- its meaning is perfectly well defined and is never going to change. That gives it an extremely elegant simplicity. This C++ solution:

	uint64_t y = std::numeric_limits<uint64_t>::max();

is wonderfully elegant in its own way, but for a completely different reason.

Here's the difference: To deal with a pesky fly, C sends a ninja mosquito; C++ mobilizes the entire history of modern aerial warfare. :)


 _______________________________________________
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: 
 >uint64_t error and architecture targets (From: Todd Heberlein <email@hidden>)
 >Re: uint64_t error and architecture targets (From: "Clark S. Cox III" <email@hidden>)
 >Re: uint64_t error and architecture targets (From: Andreas Grosam <email@hidden>)
 >Re: uint64_t error and architecture targets (From: Quincey Morris <email@hidden>)
 >Re: uint64_t error and architecture targets (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: Mix and match project build configurations
  • Next by Date: Re: Mix and match project build configurations
  • Previous by thread: Re: uint64_t error and architecture targets
  • Next by thread: Re: uint64_t error and architecture targets
  • Index(es):
    • Date
    • Thread