ifndef; endif Statement?? Can someone explain what is the following code mean??

Discussion in 'C' started by Flexline, Jan 28, 2010.

  1. Flexline

    Flexline New Member

    Joined:
    Jan 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    /* Controller handle */
    #if defined(__cplusplus)
    extern "C" {
    #endif
    typedef struct _MPIControl *MPIControl;
    #if defined(__cplusplus)
    }
    #endif
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    It means
    Code:
    #if defined(__cplusplus)
    extern "C" {
    #endif
    
    If __cplusplus is defined I declare the statement extern "C" {

    else

    Code:
    typedef struct _MPIControl *MPIControl;
    Code:
    #if defined(__cplusplus)
    }
    #endif 
    If __cplusplus is defined I close the braces I opened before.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice