From: John Love-Jensen <eljay@adobe.com>
To: Manish Verma <manish.avtaar@googlemail.com>,
GCC-help <gcc-help@gcc.gnu.org>
Subject: Re: warning when using __builtin_types_compatible_p
Date: Mon, 28 Jul 2008 11:59:00 -0000 [thread overview]
Message-ID: <C4B31A6C.326E0%eljay@adobe.com> (raw)
In-Reply-To: <9062df460807280239w1d987179oa488da2bd4d67e16@mail.gmail.com>
Hi Manish,
> I get a warning regarding the incompatible pointer type, when I
> compile a very simple program at the bottom of this email. I must be
> doing something very silly. Does anybody an idea about it?
The foo_float routine takes a float*, but you are passing in an int*, which
is an incompatible type.
Expanding your main, this is what it looks like:
int main()
{
int a = 10;
float b = 101;
{
if(__builtin_types_compatible_p(typeof(&a), int*))
foo_int(&a);
else
foo_float(&a); // <-- warning here
}
return 0;
}
It appears that you want to use some sort of function overloading. I
suggest you use C++ as a "better C" compiler, so you can use the function
overloading feature present in C++, rather than try to mimic that C++
obfuscation feature in C.
HTH,
--Eljay
prev parent reply other threads:[~2008-07-28 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 11:43 Manish Verma
2008-07-28 11:59 ` John Love-Jensen [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=C4B31A6C.326E0%eljay@adobe.com \
--to=eljay@adobe.com \
--cc=gcc-help@gcc.gnu.org \
--cc=manish.avtaar@googlemail.com \
/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).