This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

const qualifier on function return types.


Hello,

On IRIX using the MIPSPro C compiler, I get many warnings of the following
sort (GSL 0.7 -- 0.8, at least):

  cc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O -s -n32 -mips3 -Wl,-woff,85 \
     -fullwarn -c cholesky.c
  ...
  cc-3303 cc: WARNING File = ../gsl/gsl_vector_double.h, Line = 78
    A type qualifier on a return type is meaningless.

    const gsl_vector gsl_vector_const_subvector (const gsl_vector *v,
                                                 size_t i, size_t n);
  ...

I do not get these warnings on Linux/gcc using the following command line:

  gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -O -funsigned-char \
      -fwritable-strings -Wall -c cholesky.c

I searched the mailing list archive and saw a short discussion of this and
whether it is ANSI C.  I didn't see any mention of the reason for applying
the const qualifier.

What is the purpose of applying a const qualifier to a return value?  Is it
so that we can see the return value but not change it?

The library builds and works fine, but I would rather not have pages of
warnings in my applications that use the GSL.

Any suggestions?

Thanks.

-- Lowell


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]