Thread: i am not clear about peace of code..

  1. #1
    Registered User
    Join Date
    Apr 2008

    i am not clear about peace of code..

    Dear All,

    I am getting confuse in following peace of code...

    g_EEHandler_st.Callback_PV          = FUN_AxCalibEEpromCB_V;
    //they are telling that FUN_AxCalibEEpromCB_V is this correct syntax of using function..

    till now i had learnt that function having syntax of FUN_AxCalibEEpromCB_V(Optional Argument list)

    What exactly meaning of this code?

  2. #2
    Join Date
    Oct 2007
    Inside my computer
    It takes the address of the function and stores it in a function pointer.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Without context, it just assigns Callback_PV, which appears to be a member of g_EEHandler_st the value of FUN_AxCalibEEpromCB_V

    And judging by the horrible variable names, I'd say that FUN_AxCalibEEpromCB_V is a function (that is a pointer to a function -- in this case, probably the function itself). So to answer your question, no it's not the correct syntax for calling a function.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    The code you post is (or at least could be, as there is no declaration of the involved symbols) a function pointer assignment.

    It is NOT calling a function, so you should not provide arguments or ().

    A simple example would be:
    int foo(void)
       return 7;
    int main()
       int (*fptr)(void);
       fptr = foo;
       printf("call to function given by fptr=%d\n", fptr());
       return 0;
    This should display 7.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  2. Clear Screen Code
    By luckygold6 in forum Windows Programming
    Replies: 3
    Last Post: 03-07-2003, 02:53 AM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM