defining ptrdiff_t in ncconfig.h creates problems with stddef.h on Mac OS X Tiger
William Gropp
gropp at mcs.anl.gov
Fri Jun 16 07:44:05 CDT 2006
At 03:30 PM 6/15/2006, Ken Mighell wrote:
>Dear pnetcdf team,
>
>I was trying to build pnetcdf with OpenMPI using an Apple dual G5 tower
>running Mac OS X.
>
>Seems that the line
>
>#define ptrdiff_t int
I generally recommend against using names that can conflict with names in
user or system files for just this reason.
In this case, it looks like stddef.h defines ptrdiff_t, so either
ncconfig.h should ensure that stddef.h is included first (if available) and
has a definition for ptrdiff_t, or a different name should be used.
Bill
>in ncconfig.h creates havoc whenever source code includes <stddef.h> AFTER
>ncconfig.h has been included.
>Specifically, what happens,in that case, is the command
>
>typedef int int;
>
>is generated by <stddef.h> -- which causes compilation a error.
>
>uname -a
>
>gives this result:
>
>Darwin oblix.tuc.noao.edu 8.1.0 Darwin Kernel Version 8.1.0: Tue May 10
>18:16:08 PDT 2005; root:xnu-792.1.5.obj~4/RELEASE_PPC Power Macintosh powerpc
>
>mpicc --version
>
>gives this result:
>
>powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple Computer, Inc.
>build 4061)
>Copyright (C) 2004 Free Software Foundation, Inc.
>This is free software; see the source for copying conditions. There is NO
>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>The problem apparently can be made to go away by adding the line
>
>#include <stddef.h>
>
>BEFORE any source code with the line
>
>#include "ncconfig.h"
>
>Does configure need to be made a little smarter?
>
>Or should ptrdiff_t be made a typedef instead of a macro within ncconfig.h ?
>
>Sincerely yours,
>
>-Kenneth Mighell
>
>======================================
>Kenneth Mighell, Associate Scientist
>Kitt Peak National Observatory
>National Optical Astronomy Observatory
>950 North Cherry Avenue
>Tucson, AZ 85719 U.S.A.
>email: <mailto:mighell at noao.edu>mighell at noao.edu
>voice: (520) 318-8391
>fax: (520) 318-8360
>
>
>
William Gropp
http://www.mcs.anl.gov/~gropp
More information about the parallel-netcdf
mailing list