curl-library
Re: curl_off_t suffix
From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 14 Aug 2008 10:46:48 -0700
Date: Thu, 14 Aug 2008 10:46:48 -0700
On Thu, Aug 14, 2008 at 10:25:55AM +0100, Jamie Lokier wrote:
> Dan Fandrich wrote:
> > #define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
>
> I wonder why they did that??!
>
> If x is a large constant, how is that (123456789012345 + (INT64_MAX -
> INT64_MAX)) is acceptable to the compiler (note no suffix on the
> constant), but simply the constant by itself, or ((__int64_t)
> 123456789012345), are not?
I'm guessing the tokenizer treats the value as 64 bit internally, then
truncates it to a normal 32 bit int before using it in many contexts
(as per the C standard). Adding a long long to the value forces it to
remain as 64 bits.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2008-08-14