那句话的意思是从 void* 到 int 的转换丢失精度,相信看到解释有些人就明白了, 此问题只会出现在X64位的Linux上,因为在64位的机器上指针占用8个字节,int 占用四个字节,所以才会出现这样的问题, 解决方法: (long)ptr == -1 就好了
void *是特殊的指针 所有类型指针都可以付给void *;但是void *类型指针付给其他指针类型需要强制类型转换。invalid conversion from `void*' to `int*' 说明把void *指针付给int*类型的指针了。
int PopFromStack(SqStack *s)//输出栈顶到栈底的元素 { int n;SElemType e;//e=malloc (sizeof(int) * 7);for(n=1; s->top!=s->base; n++){ printf("请输入的%d个元素:",n);scanf("%d",&e);Push(s,e);} } void Creat(SqStack *s,int a)//创建栈 { int i,elem;...
不能从 void 转换为 int 翻译结果4复制译文编辑译文朗读译文返回顶部 无法转换为“无效”,从“int” 翻译结果5复制译文编辑译文朗读译文返回顶部 不能从‘空隙’转换成‘int’ 相关内容 a你多久才能到这里 How long can you here[translate] aYou said when you grade 7 will come back to China. 您说当您分...
invalid conversion from void* to int** May 14 '06, 11:05 AM Hi, I'm using this alloc_mem-function: - - - - - - - - - - - - - - - - - - - - - - - - void *alloc_mem (size_t num_elems, size_t elem_size, char *filename, int line, size_t *total_mem) { ...
Invalid Conversion From `Void*‘ To `FILE*‘ void *是特殊的指针 所有类型指针都可以付给void *;但是void *类型指针付给其他指针类型需要强制类型转换。 解决方案:invalid conversion from `void*' to `int*' 说明把void *指针付给int*类型的指针了。
how to convert void* to intMar 31, 2020 at 1:30amScarletpimp (28)I am using a library which has callback function with void* as a parameter. I need to get int from this void*, below code works fine in c but not in c++ In c: void *ptr; int n = (int)ptr; So in c++ i...
我的猜测是OP的情况是void *被用作int的一般存储,其中void *大于int。例如: int i = 123; void *v = (void*)i; // 64bit void* being (ab)used to store 32bit value [..] int i2 = (int)v; // we want our 32bits of the 64bit void* back ...
Re: cast from void* to int san wrote:[color=blue] > Hi, > > I need to cast a void* to int. > I am doing the following > > int sig = reinterpret_cas t<int> (clientData); > where clientData is of type void*. > > Its working well for 32-bit machine. > But giving error...
这是把void类型的值赋给int变量 当然不可以了 比如一个void函数A void A(){} int变量 x int x;x=A();就会出现