- 论坛徽章:
- 0
|
#include "stdafx.h"
#include <stdarg.h>
typedef unsigned int uint32;
typedef unsigned long long int uint64;
typedef struct RecPtr
{
uint64 id:8,
off:56; /* byte offset of location in log file */
} RecPtr;
static void
func(int n,...)
{
va_list args;
uint32 a;
uint64 b;
va_start(args, n);
a = va_arg(args, uint32);
b = va_arg(args, uint64);
printf("%u, %llu\n", a, b);
va_end(args);
}
int _tmain(int argc, _TCHAR* argv[])
{
RecPtr test;
test.id = 100;
test.off = 78797897;
func(2, test.id, test.off);--这个为什么是错误的??谢谢大家
func(2, (uint32)(test.id), (uint64)(test.off));
return 0;
}
为什么结果是:
100, 338434390608576512
100, 78797897 |
|