Thread: Function pointer Q

  1. #1
    Registered User
    Join Date
    Nov 2008

    Function pointer Q

    I'm trying to catch a signal interrupt. The docs on signal() say if the func pointer is equal SIG_DFL then the default action is taken. SIG_DFL looks like (void (*)(int))0. Why is there a number at the end of the function pointer? How do I declare a function that looks like that?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    That is the number zero, cast to a function pointer, and therefore represents Not An Actual Function (much like NULL represents Not An Actual Memory Address).

  3. #3
    Registered User
    Join Date
    Sep 2008
    Toronto, Canada
    Your own interrupt function would be
    void abc(int x) {
    /* do stuff with parameter x */
    Then you'd tell the system that's your function: signal( number, abc)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing method pointer as a function pointer
    By sevcsik in forum C++ Programming
    Replies: 5
    Last Post: 12-30-2007, 06:19 AM
  2. Replies: 7
    Last Post: 07-04-2007, 12:46 PM
  3. Replies: 9
    Last Post: 01-02-2007, 04:22 PM
  4. Replies: 4
    Last Post: 11-05-2006, 02:57 PM
  5. Replies: 6
    Last Post: 11-29-2004, 08:50 AM