c++ - unsigned long long conflict with uint64_t? -
this question has answer here:
we use template specialization type parameter like
class my_template_class<uint64_t m>: public my_template_class_base<uint64_t> { .... } class my_template_class<unsigned long long,m>: public my_template_class_base<unsigned long long> { .... }
this working 64-bit compilation gcc. while when try 32 bit mode, reports "previous definition" above 2 classes.
so unsigned long long
same uint64_t
in 32-bit compilation not in 64-bit compliation?
the compilation difference cxx
flag -m32
, -m64
so
unsigned long long
sameuint64_t
in 32-bit compilation not in 64-bit compilation?
yes.
in 32-bit mode, long
32 bits , long long
64 bits. in 64-bit mode, both 64 bits.
in 32-bit mode, compiler (more precisely <stdint.h>
header) defines uint64_t
unsigned long long
, because unsigned long
isn't wide enough.
in 64-bit mode, defines uint64_t
unsigned long
.
it could have defined unsigned long long
in both modes. choice arbitrary; that's required has 64-bit type.
in general, each of integer types defined in <stdint.h>
typedef predefined type appropriate characteristics. can't assume of them distinct predefined types.
Comments
Post a Comment