Re: uint64_t error and architecture targets
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