2 msgwhat is the gcc frontend #line pragma
2 msgNAMESERVER
3 msgbuilit-in function
3 msgMixing Fortran 77 and Fortran 90 code
1 msgRe: A

A 'unsigned long long ' problem
\ bacmoz (31 Jul 2006)
. \ John Love-Jensen (31 Jul 2006)

1 msgWerden sie AutoTester
2 msgA question for multi-thread building or distrib...
2 msgcurrent subversion broken for --disable-shared
1 msgSpecify section for jump tables
1 msgBuilding cross-compiler under Cygwin - am I bei...
1 msgproblem: symbol resolution in shared library
1 msgReview
2 msgName lookup in templates
2 msggcc >= 4 not catching exceptions on solaris ...
1 msgHello everybody!!
1 msgquestion on ifstream::getline()
1 msgRe: Hello everybody!! (function attached)
2 msgC / C++ Language Standards
3 msgHelp getting GCC
Subject:A 'unsigned long long ' problem
Group:Gcc-help
From:bacmoz
Date:31 Jul 2006



my cpu is amd x86-64, and os is fedora core 5 x86-64 version
gcc version 4.1.0
the program lists here
#include "stdio.h"
int main(int argc, char* argv[])
{
unsigned long long a, b;
a = 0x8000000000000000;
b = a>>1;
printf(
"a = %llu\n"
"b = %llu\n",
a, b);
a = 1<<(8 * sizeof(unsigned long long) - 1); // here give a warning
b = a>>1;
printf(
"a = %llu\n"
"b = %llu\n",
a, b);
return 0;
}
the compiler gives a warning that left shift length is more than or equal to
type width.
the result is:
a = 9223372036854775808
b = 4611686018427387904
a = 0
b = 0

use gdb, "p/t 1<<63", the result is
1000000000000000000000000000000000000000000000000000000000000000, this is
right
"p a = 1<<63", then a is
1000000000000000000000000000000000000000000000000000000000000000

i don't know why i cannot get 1<<63 in my c program.

if change the type "unsigned long long" to "unsigned int", the result is ok.
--
View this message in context: http://www.nabble.com/A-%22unsigned-long-long-%22-problem-tf2028042.html#a557735 5
Sent from the gcc - Help forum at Nabble.com.



© 2004-2008 readlist.com