#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    india
    Posts
    28
    Rep Power
    0

    anonymous function pointer


    How can i write a function pointer that will take
    any type of argument and return any type

    so that i can pass any function it for implementing

    callback in my application
    i know ordianry callnack functions
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    138
    Rep Power
    12
    If you are programming in C++ you can create templates to do that for you
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    12
    Suji,

    If you're working in C, you can pump void* types back and forth. That's a bit of overkill if all you really wanted was a character, but otherwise incurs no additional penalty.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    india
    Posts
    28
    Rep Power
    0

    Wink anonymous pointer


    Thank you . What is the problem with character pointer??
    what i will do for char pointer then . i really what character
    regards
    Suji
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    138
    Rep Power
    12
    Hi Sujji,
    Thought this link may be of some help to u
    http://www.sparknotes.com/cs/pointer.../section1.html
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    12

    Re: anonymous pointer


    Originally posted by suji
    Thank you . What is the problem with character pointer??
    what i will do for char pointer then . i really what character
    regards
    Suji
    What you'll do is cast the void* to the type of pointer that it actually represents. I do this all the time when I implement abstract data types in C, which doesn't have templates.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/

IMN logo majestic logo threadwatch logo seochat tools logo