From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lowell Johnson To: gsl-discuss@sources.redhat.com Subject: const qualifier on function return types. Date: Wed, 19 Dec 2001 13:20:00 -0000 Message-id: <01061510380302.06977@edclxw5> X-SW-Source: 2001/msg00220.html 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