Incompatible pointer type, on funtion call, but not on a attribution

Discussion in 'C Programming' started by skyshade, Oct 19, 2010.

  1. skyshade

    skyshade

    Joined:
    Oct 19, 2010
    Messages:
    2
    Likes Received:
    0
    Hello, I have a problema with above code, please some one can help me?

    ...
    isc_boolean_t
    dns_aclelement_match(const isc_netaddr_t *reqaddr,
    const dns_name_t *reqsigner,
    dns_aclelement_t *e , // << THIS NOT! :/
    const dns_aclenv_t *env,
    const dns_aclelement_t **matchelt)
    ...
    somefunction (...){
    ...
    dns_aclelement_t *e = &acl->elements; //<< THIS WORKS!!! :/
    ....
    dns_aclelement_match(reqaddr, reqsigner,
    &e, env, matchelt))
    ...
    }


    Compiler errors:

    acl.c:309: warning: passing argument 3 of ‘dns_aclelement_match’ from incompatible pointer type
    acl.c: At top level:
    acl.c:439: error: conflicting types for ‘dns_aclelement_match’
    include/dns/acl.h:350: error: previous declaration of ‘dns_aclelement_match’ was here



    IF i do in this way, its works:


    ...
    isc_boolean_t
    dns_aclelement_match(const isc_netaddr_t *reqaddr,
    const dns_name_t *reqsigner,
    const dns_aclelement_t *e , // << THIS WORKS! :///
    const dns_aclenv_t *env,
    const dns_aclelement_t **matchelt)
    ...
    somefunction (...){
    ...
    dns_aclelement_t *e = &acl->elements; //<< THIS WORKS!!! :////
    ....
    dns_aclelement_match(reqaddr, reqsigner,
    &e, env, matchelt))
    ...
    }



    Why the const in necessery on the function declation and not on the attribution, i need to pass this variable by reference to the function and alter it inside this function. How can i do this??


    Thanks everyone.


    Sky
     
    skyshade, Oct 19, 2010
    #1
    1. Advertisements

  2. skyshade

    skyshade

    Joined:
    Oct 19, 2010
    Messages:
    2
    Likes Received:
    0
    SOLVED

    There is a damn XXX.h included that have a prototype for dns_aclelement_match, after change the XXX.h and all works fine.
     
    skyshade, Oct 19, 2010
    #2
    1. Advertisements

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. =?Utf-8?B?S2VuTGVl?=
    Replies:
    1
    Views:
    8,527
    Mark Newmister
    Feb 13, 2006
  2. Brian Stubblefield

    initialization from incompatible pointer type

    Brian Stubblefield, May 25, 2004, in forum: C Programming
    Replies:
    3
    Views:
    15,673
    Brian Stubblefield
    May 27, 2004
  3. Chris Readle

    Passing arg from incompatible pointer type

    Chris Readle, Jun 20, 2004, in forum: C Programming
    Replies:
    15
    Views:
    25,553
    Dan Pop
    Jun 24, 2004
  4. Josh Wilson

    tmpnam, strcpy - incompatible pointer type?

    Josh Wilson, Jun 21, 2004, in forum: C Programming
    Replies:
    1
    Views:
    4,069
    Eric Sosman
    Jun 21, 2004
  5. Knoppix User
    Replies:
    3
    Views:
    414
    Knoppix User
    Jan 11, 2004
  6. gk245
    Replies:
    10
    Views:
    1,244
    Peter Shaggy Haywood
    Apr 22, 2006
  7. Michael

    incompatible pointer type warning ?

    Michael, Jun 5, 2006, in forum: C Programming
    Replies:
    8
    Views:
    718
    Ian Collins
    Jun 5, 2006
  8. Lee Xuzhang
    Replies:
    5
    Views:
    563
    Kevin D. Quitt
    Jun 14, 2006
Loading...