This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
const qualifier on function return types.
- To: gsl-discuss at sources dot redhat dot com
- Subject: const qualifier on function return types.
- From: Lowell Johnson <ldjohn at usgs dot gov>
- Date: Fri, 15 Jun 2001 10:09:00 -0500
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