__/ [ M ] on Saturday 13 May 2006 20:28 \__
> Tim Smith wrote:
>
>> In article <1147506449.314246.192970@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, sonu
>> wrote:
>>> i wrote like
>>> main()
>>> {
>>> guint64 x=0xffffffffffffffff
>>>
>>> printf("%15d",x);
>>> }
>>>
>>> But it is showing warning integer constant is too large for "long"
>>> type
>>
>> First, next time paste in your exact code. The code you gave above is
>> missing a semicolon, and so will give more errors than what you listed.
>>
>> Second, next time show the exact and complete error message. If you had
>> shown:
>>
>> a.c:3: warning: integer constant is too large for "long" type
>>
>> instead of just paraphrasing it, then the other three people who have
>> already tried to help you would have realized the error is about the
>> assignment line (line 3), and not the printf line. You've wasted their
>> time and yours because they are focusing on the possible error in the
>> printf format you are using, which has nothing to do with your error you
>> are actually asking about.
>>
>> (That's not to say the printf line is without error, so do keep the other
>> responses in mind after you get past the error you were asking about, as
>> they will be helpful with the error you are going to then run into).
>>
>> Now, on to the problem. You need to tell it that your constant is
>> supposed
>> to be 64-bits. How you do this depends on the compiler, I believe, as
>> this
>> is not part of standard C. For this particular compiler, try sticking a
>> suffix of "LL" on the constant:
>>
>> guint64 x = 0xffffffffffffffffLL;
>>
>> I have not been able to directly test this, because my gcc does not
>> recognize guint64. However, if I do this:
>>
>> long long x = 0xffffffffffffffff;
>>
>> I get the same error you got, and if I do this:
>>
>> long long x = 0xffffffffffffffffLL;
>>
>> the error goes away.
>>
>> (And if guint64 is a typedef that is coming from some header file you are
>> including, you should have included the #include in the code you posted).
>>
>
> I haven't got any access to 64 bit machines *yet*, so I haven't needed to
> do anything like that. However I will keep that one in my back pocket :-)
>
> Wounder if they will change the suffix if and when we ever go to 128 bit
> machines.
,----[ Quote ]
| System/370, made by IBM, is possibly considered the first rudimentary
| 128-bit computer as it used 128-bit floating point registers. Most
| modern CPUs such as the Pentium and PowerPC have 128-bit vector
| registers used to store several smaller numbers, such as 4 32-bit
| floating-point numbers. A single instruction can operate on all these
| values in parallel (SIMD). They are 128-bit processors in the sense that
| they have registers 128 bits wide?they load and store memory in units of
| 128 bits?but they do not operate on single numbers that are 128 binary
| digits in length.
`----
Source: http://en.wikipedia.org/wiki/128-bit
Can't wait 'till the kilobit processor. Imagine the compexity of the chip and
the compiler...
|
|