Re: type mismatch

Discussion in 'C Programming' started by Artie Gold, Feb 28, 2004.

  1. Artie Gold

    Artie Gold Guest

    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!"
     
    Artie Gold, Feb 28, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    640
    Karl Seguin
    Aug 10, 2005
  2. type mismatch error

    , Aug 12, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,366
    Kevin Spencer
    Aug 12, 2005
  3. Harry Pehkonen

    win32com, string array --> Type mismatch?

    Harry Pehkonen, Aug 8, 2003, in forum: Python
    Replies:
    2
    Views:
    1,874
    Harry Pehkonen
    Aug 11, 2003
  4. Replies:
    5
    Views:
    405
    dcherna
    Jan 17, 2007
  5. programmingzeal
    Replies:
    0
    Views:
    1,129
    programmingzeal
    May 6, 2012
Loading...

Share This Page