Thread: What is here defined? Please help

  1. #1
    Registered User
    Join Date
    Nov 2016
    Posts
    84

    What is here defined? Please help

    Hi all,

    I don`t understand what exactly in typedef GIOPBool is defined?
    Can someone help me out?

    Code:
    ...
    struct ApplAdminCmdAndProcessingFunction;
    friend class ApplAdminCmdAndProcessingFunction;
    
    typedef GIOPBool (
    SrvInvocationListener:: * ApplAdminCmdProcessingFct)(
     const char * myCmdName,
     size_t argc,
     // 'argv[0]' is the command name
     // as contained in the command
     const char * argv[],
     // '* output' is expected to become 0
     // or to point to a buffer allocated via 'new []';
     // '* output' is expected to keep
     // - the command execution result
     // on success (if 'GIOPTrue' is returned)
     // - an error message
     // on error (if 'GIOPFalse' is returned)
     char ** output);
    
    struct ApplAdminCmdAndProcessingFunction
    {
     const char * m_cmdName;
     ApplAdminCmdProcessingFct m_fct;
     const char * m_argNames[16 + 1];
    };
    
    static const ApplAdminCmdAndProcessingFunction allCmds[];
    static const ApplAdminCmdAndProcessingFunction * const helpCmd;
    
    GIOPBool cmdHelp(
     const char * myCmdName,
     size_t argc,
     const char * argv[],
     char ** output)
     throw();
    
    GIOPBool cmdReportStatisticData(
     const char * myCmdName,
     size_t argc,
     const char * argv[],
     char ** output)
     throw();
    
    ...

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    It's defining ApplAdminCmdProcessingFct as being a function pointer.


    The Function Pointer Tutorials - Index
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2016
    Posts
    84
    Quote Originally Posted by Salem View Post
    It's defining ApplAdminCmdProcessingFct as being a function pointer.


    The Function Pointer Tutorials - Index
    And what is GIOPBool cmdHelp and GIOPBool cmdReportStatisticData?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    They're just regular function prototypes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Nov 2016
    Posts
    84
    Quote Originally Posted by Salem View Post
    They're just regular function prototypes.
    What about these one:

    Code:
    struct ApplAdminCmdAndProcessingFunction
    {
     const char * m_cmdName;
     ApplAdminCmdProcessingFct m_fct;
     const char * m_argNames[16 + 1];
    };
     
    static const ApplAdminCmdAndProcessingFunction allCmds[];
    static const ApplAdminCmdAndProcessingFunction * const helpCmd;

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    ApplAdminCmdAndProcessingFunction is a struct.
    Line #8 is not valid C++, but it is apparently trying to declare an array of ApplAdminCmdAndProcessingFunction objects.
    Line #9 creates a pointer to a const ApplAdminCmdAndProcessingFunction. The pointer itself is also const. So you can't change the object it points to, and you can't change he pointer itself. I'm not sure that should compile.
    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.

  7. #7
    Registered User
    Join Date
    Nov 2016
    Posts
    84
    Quote Originally Posted by Elysia View Post
    ApplAdminCmdAndProcessingFunction is a struct.
    Line #8 is not valid C++, but it is apparently trying to declare an array of ApplAdminCmdAndProcessingFunction objects.
    Line #9 creates a pointer to a const ApplAdminCmdAndProcessingFunction. The pointer itself is also const. So you can't change the object it points to, and you can't change he pointer itself. I'm not sure that should compile.
    Thank you very much. But I didn`t get the whole context..What is the programmer trying to do here?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 07-19-2015, 05:51 PM
  2. _WINDOWS_ not getting defined
    By ToddlerGraphics in forum Windows Programming
    Replies: 5
    Last Post: 10-18-2011, 09:06 AM
  3. how to use a self-defined lib in VC6
    By wu7up in forum C Programming
    Replies: 4
    Last Post: 05-12-2003, 03:04 AM
  4. Static but never defined?
    By electrolove in forum C Programming
    Replies: 3
    Last Post: 03-25-2003, 07:11 AM
  5. #if defined...
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 01-06-2002, 08:08 PM

Tags for this Thread