From: Brian Gough <bjg@network-theory.co.uk>
To: Lowell Johnson <ldjohn@usgs.gov>
Cc: gsl-discuss@sources.redhat.com
Subject: Re: const qualifier on function return types.
Date: Wed, 19 Dec 2001 13:20:00 -0000 [thread overview]
Message-ID: <15146.39476.608398.5090@debian> (raw)
In-Reply-To: <01061510380302.06977@edclxw5>
Lowell Johnson writes:
> cc-3303 cc: WARNING File = ../gsl/gsl_vector_double.h, Line = 78
> A type qualifier on a return type is meaningless.
>
> 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?
That was the intention, but it doesn't work. The const on those
return types is meaningless, as the compiler says.
The cause of the warnings is functions like
const gsl_vector gsl_vector_const_view (const gsl_vector * v, ..)
The logic behind the return type was to preserve constness when
creating vector views, so that a view of a "const gsl_vector *" would
also be const. It doesn't actually work because the views are
returned as structs and C doesn't preserve constness when copying
structs.
I'll have to do something about it .. it is unsatisfactory right now.
prev parent reply other threads:[~2001-12-19 13:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-19 13:20 Lowell Johnson
2001-12-19 13:20 ` Brian Gough
2001-12-19 13:20 ` Lowell Johnson
2001-12-19 13:20 ` Brian Gough
2001-12-19 13:20 ` Brian Gough [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15146.39476.608398.5090@debian \
--to=bjg@network-theory.co.uk \
--cc=gsl-discuss@sources.redhat.com \
--cc=ldjohn@usgs.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).