C 选择';长';与';长-长';作为LP64/ILP64/LLP64数据模型下的64位类型?

C 选择';长';与';长-长';作为LP64/ILP64/LLP64数据模型下的64位类型?,c,gcc,64-bit,long-integer,long-long,C,Gcc,64 Bit,Long Integer,Long Long,我试图了解使用long或long选择内置64位数据类型的要求。我很难理解long与long的类型等价性和对齐要求 在LP64/ILP64/LLP64数据模型下选择long与long作为64位类型时,最佳做法或标准是什么 这里有一些相关的问题。它们完全涵盖了其他主题,比如sizeof(long)。这就是我讨厌使用原始整数类型的原因FTW@Mysticial-我知道你的意思。。。我想换成uint64\t和朋友至少5年或10年了。有一些非技术性的障碍/要求阻止了我。 #if _LP64 || __L

我试图了解使用
long
long
选择内置64位数据类型的要求。我很难理解
long
long
的类型等价性和对齐要求

在LP64/ILP64/LLP64数据模型下选择
long
long
作为64位类型时,最佳做法或标准是什么



这里有一些相关的问题。它们完全涵盖了其他主题,比如
sizeof(long)。这就是我讨厌使用原始整数类型的原因<代码>
FTW@Mysticial-我知道你的意思。。。我想换成
uint64\t
和朋友至少5年或10年了。有一些非技术性的障碍/要求阻止了我。
#if _LP64 || __LP64__ || _ILP64 || __ILP64__
typedef my_u64 unsigned long;
#else
typedef my_u64 unsigned long long;
#endif
$ gcc -mrdrnd test.cc -o test.exe
test.cc: In function ‘int main(int, char**)’:
test.cc:18:22: error: invalid conversion from ‘my_u64* {aka long unsigned int*}’ to ‘long long unsigned int*’ [-fpermissive]
   _rdrand64_step(&val);
                      ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:46:0,
                 from test.cc:2:
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/immintrin.h:166:1: note: initializing argument 1 of ‘int _rdrand64_step(long long unsigned int*)’
 _rdrand64_step (unsigned long long *__P)
 ^
$ gcc test.cc -o test.exe
test.cc: In function ‘int main(int, char**)’:
test.cc:21:16: error: invalid conversion from ‘my_u64* {aka long long unsigned int*}’ to ‘const uint64_t* {aka const long unsigned int*}’ [-fpermissive]
   vld1q_u64(val);
                ^
In file included from test.cc:4:0:
/usr/lib/gcc/aarch64-linux-gnu/4.9/include/arm_neon.h:17003:1: note: initializing argument 1 of ‘uint64x2_t vld1q_u64(const uint64_t*)’
 vld1q_u64 (const uint64_t *a)
 ^
$ cat test.cc
#if __x86_64__
#include <x86intrin.h>
#elif __aarch64__
#include <arm_neon.h>
#include <arm_acle.h> 
#endif

#if _LP64 || __LP64__
typedef unsigned long my_u64;
#else
typedef unsigned long long my_u64;
#endif

int main(int argc, char* argv[])
{
#if __x86_64__
  my_u64 val;
  _rdrand64_step(&val);
#elif __aarch64__
  my_u64 val[2];
  vld1q_u64(val);
#endif

  return 0;
}