Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7522683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:35:35+00:00 2026-05-30T02:35:35+00:00

I want to use a class method in the signal method signal(SIGALRM, syncro); syncro

  • 0

I want to use a class method in the signal method

signal(SIGALRM, syncro);

syncro is the name of another class method.

void states::syncro( int parameter )
{

}

I try with syncro, &syncro, states::syncro, and &states::syncro but all of them throw error messages when compiling.

error: argument of type ‘void (states::)(int)’ does not match ‘void (*)(int)’
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:35:36+00:00Added an answer on May 30, 2026 at 2:35 am

    You are able to call only free function or static class function in this case

    signal‘s signature is

    typedef void (*sighandler_t)(int);
    sighandler_t signal(int signum, sighandler_t handler);
    

    That means that it accepts only pointer to free function or static function.

    Note, that you should always have an object to call member function, say, if you have

    struct S
    {
        void method();
    }
    S obj;
    

    you can only call obj.method(), but never S::method() or method(), and pointer to S::method has type void (S::*)().

    But if your S::method() was declared static you could call it with S::method().

    That’s why pointers to free functions are incompatible with pointers to member functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use Class.getMethod(String name, Class... parameterTypes) to find the method I need
I want to use a category to make a method on the original class
I have the following class, where I want to use the method location_change within
i want to use generic class to shorter my codes because 1) GetMaintData(int taskID)
I want to use the combination method with a custom class. If my class
I want to use iterators in template class method. Here is my code: (testclass.h)
I want to use imports inside a class that is then inherited by another
i use java reflections to get methods used in a class.I also want to
In a Android application I want to use Scanner class to read a list
I want to use the DbProvider class to construct a generic DAL component. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.