Re: type mismatch
From: Artie Gold (artiegold_at_austin.rr.com)
Date: 02/28/04
- Previous message: Michael Fyles: "Re: need help new to C programming"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 28 Feb 2004 14:20:42 -0600
Frédéric Liné wrote:
> I use gcc 3.2.2 and I got this warning :
>
> interface.c:501: warning: type mismatch with previous implicit declaration
> interface.c:204: warning: previous implicit declaration of `parent'
> interface.c:501: warning: `parent' was previously implicitly declared to return `int'
>
>
> The line 204 is this one :
>
> p_parent = (GtkTreeIter *) parent();
Some warnings are cryptic; this one, however, is not!
Since there is no prototype for the function `parent()' in scope, the
compiler assumes it returns `int' (and at some point, someone put in the
ugly cast).
When the compiler encountered the definition of `parent()' it went
(colloquially): "Whoa! Since you hadn't told me different, I though it
returned an `int'. Now you're telling me it returns a pointer to
`GtkTreeInter'. I'd better issue a warning!"
>
>
>
>
> And the definition of parent line 501 is as follows :
>
> GtkTreeIter *parent (void){
>
> /* Le tableau suivant va nous permettre de stocker la profondeur de
>
> l'appel, l'iter parent et l'iter en cours */
>
> if(iterArray->len==0) return NULL;
>
> return (g_array_index(iterArray,t_couche,0)).parent;
>
> }
>
>
> I can't guess why the compiler print the warning. can you help me ?
>
See above.
HTH,
--ag
-- Artie Gold -- Austin, Texas "Yeah. It's an urban legend. But it's a *great* urban legend!"
- Previous message: Michael Fyles: "Re: need help new to C programming"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|