[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ncgen c-test trouble



Hi Alexander,

> Thank you very much for your replies,
> 
> I understood what's going wrong. Here is my notes:
> 
> There is assertion failure when I run test targets for ncgen utility. This
> assertion localized in file ncgen/genlib.c, lines 1116 and 1200, isprint()
> call:
> assert((c+1)<=256). As compared with previous version 3.5.1, the only
> difference
> is conversion of argument type to (unsigned char) before call. This is
> nothing
> more then just suppress the assertion.

I'm still not sure I understand if you are suggesting this is a bug we
should fix, even though you have found a way to solve the problem.

In looking at the source in various versions of netCDF, it appears to
me that the genlib.c source you refer to

            if (!isprint(*istr)) {
                static char octs[] = "01234567";
                int rem = ((unsigned char)*istr)%64;
                *cp++ = '\\';
                *cp++ = octs[((unsigned char)*istr)/64]; /* to get, e.g. '\177' 
*/
                *cp++ = octs[rem/8];
                *cp++ = octs[rem%8];
            } else {

has not changed since version 3.4, released in March, 1998, and
contains no call to the "assert" macro.  The "isprint" function is
supposed to be found in the runtime C library (or maybe defined as a
macro) that's declared in /usr/include/ctype.h.  If it invokes
"assert", that may be a problem with the implementation of isprint(),
which is supposed to accept integer arguments.

Anyway, if it's convenient, please tell us the compiler and operating
system on which the assertion violation in testing ncgen showed up.
Thanks!

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden          http://www.unidata.ucar.edu/staff/russ