I would tink if its typecast to same type - comparision would work.. if ((ssize_t)write(fd,vals,m*n*sizeof(double)) != (ssize_t)(m*n*sizeof(double))) abort();
I'll give this a try... Satish On Tue, 13 Sep 2016, Barry Smith wrote: > > I need help from someone who knows the subtleties of c++. We have a PETSc > example that always compiles fine with C but generates annoying warnings with > C++. I've tried many different variants to eliminate the warnings with no luck > > Any help is appreciated. > > Barry > > > mpicxx -o ex45.o -c -Wall -Wwrite-strings -Wno-strict-aliasing > -Wno-unknown-pragmas -fvisibility=hidden -g -O -fPIC > -I/sandbox/petsc/petsc.clone-3/include > -I/sandbox/petsc/petsc.clone-3/arch-linux-opt-cxx-quad/include > -I/usr/include/mpich2 `pwd`/ex45.c > /sandbox/petsc/petsc.clone-3/src/mat/examples/tests/ex45.c: In function > ‘void Store2DArray(int, int, double*, const char*, int*)’: > /sandbox/petsc/petsc.clone-3/src/mat/examples/tests/ex45.c:75:41: warning: > comparison between signed and unsigned integer expressions [-Wsign-compare] > if (write(fd,vals,m*n*sizeof(double)) != ((unsigned int) > (m*n))*sizeof(double)) abort(); > ^ > /sandbox/petsc/petsc.clone-3/src/mat/examples/tests/ex45.c: In function > ‘void Store1DArray(int, double*, const char*, int*)’: > /sandbox/petsc/petsc.clone-3/src/mat/examples/tests/ex45.c:97:36: warning: > comparison between signed and unsigned integer expressions [-Wsign-compare] > if (write(fd,a,m*sizeof(double)) != ((unsigned int)m)*sizeof(double)) > abort(); > > > It can be found here > ftp://ftp.mcs.anl.gov/pub/petsc/nightlylogs/archive/2016/09/13/examples_next_arch-linux-opt-cxx-quad_grind.log
