linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Steve Graegert <graegerts@gmail.com>
Cc: C programming list <linux-c-programming@vger.kernel.org>
Subject: Re: type qualifiers on function return types?
Date: Thu, 8 Dec 2005 12:58:44 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.63.0512081257140.7428@localhost.localdomain> (raw)
In-Reply-To: <6a00c8d50512080858n70ef1937n8ccc2c96b9eb799c@mail.gmail.com>

On Thu, 8 Dec 2005, Steve Graegert wrote:

> On 12/8/05, Robert P. J. Day <rpjday@mindspring.com> wrote:
> >
> >   i was just handed a pile of source code that, upon first build,
> > complains thusly:
> >
> > header.h:20: warning: type qualifiers ignored on function return type
> > header.h:22: warning: type qualifiers ignored on function return type
> >
> >   at those lines, we read:
> >
> >   typedef struct blah {
> >     volatile void           (**start_address)(void);    <--
> >     volatile char*          stack;
> >     volatile void           (**manual_start_address)(void); <--
> >     ...
> >
> > which seems to explain the warnings since i never thought you
> > could add type qualifiers to function return types.  or is there
> > something incredibly clever happening here that i've never seen
> > before?  just wondering why someone would have coded it that way
> > in the first place.
>
> Since functions can only return rvalues and the type qualifiers
> apply only to lvalues, it is meaningless and therefore ignored.

that's what i thought but, since i'm still working on the intricacies
of the language, whenever i come across something that mysterious, i
always assume it's just some idiomatic cleverness i've never seen
before.

of course, after that, i finally figure out it was just bad
programming.  :-(

rday

p.s.  i'm not *trying* to ask dumb questions.  i am merely succeeding.

  parent reply	other threads:[~2005-12-08 17:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 12:32 type qualifiers on function return types? Robert P. J. Day
2005-12-08 16:58 ` Steve Graegert
2005-12-08 17:43   ` Nate Jenkins
2005-12-08 18:00     ` Robert P. J. Day
2005-12-08 18:07     ` Steve Graegert
2005-12-08 18:16       ` Nate Jenkins
2005-12-09 19:25     ` Glynn Clements
2005-12-08 17:58   ` Robert P. J. Day [this message]
2005-12-09 19:03     ` Glynn Clements
2005-12-09 19:04       ` Robert P. J. Day

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=Pine.LNX.4.63.0512081257140.7428@localhost.localdomain \
    --to=rpjday@mindspring.com \
    --cc=graegerts@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /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 NNTP newsgroup(s).