Re: compiling with pgCC

Hi Rorik,

> This is continuing the question about using Portland Group pgCC to 
> compile netcdf_c++.  I'm using netcdf-3.6.2-beta3.  The warning that 
> occurs is
> 
>    integer conversion resulted in a change of sign
>    static const ncbyte ncBad_byte = NC_FILL_BYTE;
> 
> In the archives of 20030217, Russ said this was an error in PG versions
> < 4.0.  However, I am getting it with version 6.0. ...

Actually, I was referring to a different error (an undefined
reference), not to the warning about change of sign.  Although it is
valid C++ to store a signed quantity in an unsigned variable, the
Portland Group compiler is just being "extra helpful" in providing a
warning about this, because it may not be what was intended.  The
warning may just be ignored in this case.

>                                                ...  So, I dug around the
> netcdf source, and I'm still confused.
> 
> in netcdf.h (showing line numbers)
> 65 #define NC_FILL_BYTE ((signed char)-127)
> 
> and in ncvalues.h (showing line numbers)
> 18 typedef unsigned char ncbyte;
> ...
> 35 static const ncbyte ncBad_byte = NC_FILL_BYTE;
> 
> It seems there is indeed an issue with signed versus unsigned char.  Am
> I missing something?  And in the meantime, how safe am I to redefine
> NC_FILL_BYTE to ((unsigned char)0) ?

If you redefine NC_FILL_BYTE to ((unsigned char)0) in the library
source, programs linked with your library will behave differently from
programs linked with the version we distribute under some
circumstances.  Rather than change the default fill value for ncbyte,
it would be better to just ignore the warning.  If you want to use a
different fill value for any specific variable of type ncbyte, you can
do that by adding the "_FillValue" attribute for that variable.

--Russ

==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: