最近学习多线程,写Demo程序时,遇到一个编译器告警,就是在用 pthread_join 函数获取线程返回状态值时,出现 -Wpointer-to-int-cast 告警。下面来看一下具体是啥问题 原Demo 程序如下: #include<stdio.h>#include<stdlib.h>#include<assert.h>#include<pthread.h>void*func
警告信息 "cast from pointer to integer of different size [-Wpointer-to-int-cast]" 指的是在代码中进行了从指针类型到整数类型的转换,但这个转换在大小上是不匹配的。在不同的平台上,指针的大小(通常是32位或64位)和整数类型(如 int,long 等)的大小可能不同。因此,直接进行这样的转换可能会导致数据丢失...
cairo_jpg.c:223:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return write((long)closure, data, length) < length ? CAIRO_STATUS_WRITE_ERROR : CAIRO_STATUS_SUCCESS; cairo_jpg.c: In function 'cairo_image_surface_write_to_jpeg': cairo_jpg.c:279:...
In a 32-bit build (originally when cross-compiling, but also visible after a quick ./configure CFLAGS=-m32), with GCC 4.8 / 4.9 I get the following warning: formdata.c: In function 'FormAdd': formdata.c:390:21: warning: cast from pointer...