我很惊讶在这个 HP-UX 11.31(IA64) 中得知 long 和 time_t 类型是 4 字节大小。我可以问为什么吗?
我的环境:
$ uname -a
HP-UX bdev1 B.11.31 U ia64 0999202893 unlimited-user license
$ cat /usr/include/sys/_time_t.h
......
# ifndef _TIME_T
# define _TIME_T
# ifdef _KERNEL
typedef int32_t time_t;
# else /* !_KERNEL */
_NAMESPACE_STD_START
typedef long time_t;
_NAMESPACE_STD_END
# endif /* !_KERNEL */
# endif /* _TIME_T */
我的代码:
$ cat sizeof.cpp
#include <iostream>
#include <ctime>
#define PRINT_SIZE(a) \
std::cout << #a << ": " << sizeof(a) << std::endl
int main(void)
{
PRINT_SIZE(long);
PRINT_SIZE(time_t);
return 0;
}
$ aCC sizeof.cpp
$ ./a.out
long: 4
time_t: 4
任何人都可以帮助我找到一种通过 aCC 将 time_t 设置为 64 位的方法吗?