[MINC-development] warning from volume_io/alloc.h

Claude LEPAGE claude at bic.mni.mcgill.ca
Tue Dec 11 18:49:24 EST 2012


Hi,

Would anyone object to change volume_io/Include/volume_io/alloc.h
to avoid a compilation warning for const char *?

Here is the new piece of code:

#ifdef NO_DEBUG_ALLOC
#define  _ALLOC_SOURCE_LINE
#define  _ALLOC_SOURCE_LINE_ARG_DEF
#define  _ALLOC_SOURCE_LINE_ARGUMENTS
#define  PRINT_ALLOC_SOURCE_LINE
#else
#define  _ALLOC_SOURCE_LINE    , (char*)__FILE__, __LINE__
#define  _ALLOC_SOURCE_LINE_ARG_DEF   , char  filename[], int line_number
#define  _ALLOC_SOURCE_LINE_ARGUMENTS   , filename, line_number
#define  PRINT_ALLOC_SOURCE_LINE   \
         print_alloc_source_line( filename, line_number );
#endif


Note the cast (char*) on __FILE__, which is consistent with the 
definition on the next line char filename[]. By default, the compiler 
assumes const char * and writes out a warning. Unless we change
_ALLOC_SOURCE_LINE_ARG_DEF to const char filename[]...

Andrew, I'll let you githubize this one as I'm not a minc developer. :-)

Claude


More information about the MINC-development mailing list