From: Glynn Clements <glynn@gclements.plus.com>
To: James Colannino <james@colannino.org>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: How to prototype functions that return pointers
Date: Sun, 26 Jun 2005 04:36:46 +0100 [thread overview]
Message-ID: <17086.8910.710433.444595@gargle.gargle.HOWL> (raw)
In-Reply-To: <42BC7A4F.60304@colannino.org>
James Colannino wrote:
> Ok, so this is a very embarassing question. I tried googling for the
> answer but haven't figured it out yet, and everything I've tried results
> in compilation errors. I want to prototype a function that takes nothing
> as an argument but returns a pointer to a character.
char *myfunc(void);
> I've tried the following:
>
> char * readline();
> char *readline();
Both of these declare a function taking unspecified arguments and
returning a char*. If the function takes no arguments, the argument
list should be declared as "void".
> These first two result in 4 errors, each one identical and each one
> telling me "error: two or more data types in declaration of 'readline' "
That error isn't related to your prototypes, but the context in which
they occur. In your follow-up, you note:
> I found
> out though that the "two or more data types" error was the result of a
> more difficult bug to find that had to do with something in another
> header file.
That seems likely.
--
Glynn Clements <glynn@gclements.plus.com>
prev parent reply other threads:[~2005-06-26 3:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-24 21:25 How to prototype functions that return pointers James Colannino
[not found] ` <op.ssv8s2eyizdgzp@mail.nairnconsulting.ca>
2005-06-24 21:50 ` James Colannino
2005-06-25 6:22 ` wwp
2005-06-25 6:56 ` Steve Graegert
2005-06-26 3:36 ` Glynn Clements [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=17086.8910.710433.444595@gargle.gargle.HOWL \
--to=glynn@gclements.plus.com \
--cc=james@colannino.org \
--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).