passing a function pointer

This is a discussion on passing a function pointer within the C++ Programming forums, part of the General Programming Boards category; woops! Ain't thinking clear, sorry for that! But thanks again, both of you!...

  1. #16
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    woops! Ain't thinking clear, sorry for that!
    But thanks again, both of you!
    Currently research OpenGL

  2. #17
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    http://codepad.org/opw4HeWp

    Now, I'd like suggestions on this and is there anyway to check if a pointer, like the used pFrameFunc pointer, has been assigned anything else than 'garbage' ? Like, if it has been assigned by the code, and not some default compiler thing...

    And for the suggestions, I mean would this be the right place for the loop? I don't want the users of this engine to make the loop themselves...
    And I use the variable "bool& failed" as the condition for the loop, there is no problem with this? I mean, it is a pointer... Just to make me more sure about this!
    Thanks in advance!
    Currently research OpenGL

  3. #18
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Now, I'd like suggestions on this and is there anyway to check if a pointer, like the used pFrameFunc pointer, has been assigned anything else than 'garbage' ? Like, if it has been assigned by the code, and not some default compiler thing...
    Like any other pointer you should set it to NULL initially, since NULL checks are the only way to make sure if the pointer points to something.

    And for the suggestions, I mean would this be the right place for the loop? I don't want the users of this engine to make the loop themselves...
    And I use the variable "bool& failed" as the condition for the loop, there is no problem with this? I mean, it is a pointer... Just to make me more sure about this!
    Thanks in advance!
    I don't see why you'd want an infinite loop there.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Replies: 9
    Last Post: 12-25-2007, 04:01 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  5. Passing a function pointer to a templated type
    By skorman00 in forum C++ Programming
    Replies: 2
    Last Post: 04-13-2004, 08:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21