This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: More fortran dir warning fixes
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: More fortran dir warning fixes
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 29 Nov 1999 02:04:52 -0700
- cc: egcs-patches at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <199911290248.VAA27925@caip.rutgers.edu>you write:
> > From: Jeffrey A Law <law@cygnus.com>
> >
> > > name = bsearch ("foo", &names[0], ARRAY_SIZE (names), sizeof
> (names[
> > > 0]),
> > > - (int (*)()) strcmp);
> > > + (int (*)(const void *, const void *)) strcmp);
> > I get a little worried when we have to cast system level function pointe
> rs
> > like this. What precisely about strcmp is causing problems?
> > jeff
>
> Well there's two things, why cast at all, and why did I add the
> arguments. (I think you meant the first one, but I'll answer both.)
Yes, I meant the first.
> Regarding the first question, you need some sort of cast because the
> prototype for strcmp is "int(*)(const char *, const char *)" and
> bsearch is expecting const void * arguments. Gcc complains when you
> pass it strcmp without any cast at all.
>
Sigh. Aren't void * and char * supposed to be interchangeable for this
kind of stuff? No? How lame.
jeff