what is the following type

Discussion in 'C++' started by Mosfet, Dec 1, 2008.

  1. Mosfet

    Mosfet Guest

    Hi,

    I am looking at some source code and in one file there is the following
    definition :

    typedef enum _EXCEPTION_DISPOSITION {
    ExceptionContinueExecution,
    ExceptionContinueSearch,
    ExceptionNestedException,
    ExceptionCollidedUnwind,
    ExceptionExecuteHandler
    } EXCEPTION_DISPOSITION;

    typedef EXCEPTION_DISPOSITION EXCEPTION_ROUTINE (
    struct _EXCEPTION_RECORD *ExceptionRecord,
    void *EstablisherFrame,
    struct _CONTEXT *ContextRecord,
    struct _DISPATCHER_CONTEXT *DispatcherContext
    );
    typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;

    EXCEPTION_ROUTINE __C_specific_handler;

    I am puzzled by the EXCEPTION_ROUTINE definition, it looks like a
    function pointer but without the *. Is it a function pointer ?
    Mosfet, Dec 1, 2008
    #1
    1. Advertising

  2. Mosfet

    Mosfet Guest

    Mosfet a écrit :
    > Hi,
    >
    > I am looking at some source code and in one file there is the following
    > definition :
    >
    > typedef enum _EXCEPTION_DISPOSITION {
    > ExceptionContinueExecution,
    > ExceptionContinueSearch,
    > ExceptionNestedException,
    > ExceptionCollidedUnwind,
    > ExceptionExecuteHandler
    > } EXCEPTION_DISPOSITION;
    >
    > typedef EXCEPTION_DISPOSITION EXCEPTION_ROUTINE (
    > struct _EXCEPTION_RECORD *ExceptionRecord,
    > void *EstablisherFrame,
    > struct _CONTEXT *ContextRecord,
    > struct _DISPATCHER_CONTEXT *DispatcherContext
    > );
    > typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;
    >
    > EXCEPTION_ROUTINE __C_specific_handler;
    >
    > I am puzzled by the EXCEPTION_ROUTINE definition, it looks like a
    > function pointer but without the *. Is it a function pointer ?


    Hum actually I think it's a function type ... Someone to confirm ?
    Mosfet, Dec 1, 2008
    #2
    1. Advertising

  3. Mosfet

    James Kanze Guest

    On Dec 1, 9:55 pm, Mosfet <> wrote:

    > I am looking at some source code and in one file there is the following
    > definition :


    It looks more like C than C++. The naming conventions are also
    illegal, resulting in a lot of undefined behavior (both in C and
    in C++). However...

    > typedef enum _EXCEPTION_DISPOSITION {
    > ExceptionContinueExecution,
    > ExceptionContinueSearch,
    > ExceptionNestedException,
    > ExceptionCollidedUnwind,
    > ExceptionExecuteHandler
    > } EXCEPTION_DISPOSITION;


    > typedef EXCEPTION_DISPOSITION EXCEPTION_ROUTINE (
    > struct _EXCEPTION_RECORD *ExceptionRecord,
    > void *EstablisherFrame,
    > struct _CONTEXT *ContextRecord,
    > struct _DISPATCHER_CONTEXT *DispatcherContext
    > );
    > typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE;


    > EXCEPTION_ROUTINE __C_specific_handler;


    > I am puzzled by the EXCEPTION_ROUTINE definition, it looks
    > like a function pointer but without the *. Is it a function
    > pointer ?


    No. It's a function (type). You can use it to declare
    functions, but not to define them. Thus, __C_specific_handler
    is an (extern) function, or it would be if the name didn't
    trigger undefined behavior.

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
    James Kanze, Dec 2, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Lilja
    Replies:
    3
    Views:
    335
    Alf P. Steinbach
    Mar 6, 2005
  2. heyo
    Replies:
    3
    Views:
    887
    Dan Pop
    Apr 1, 2004
  3. pete
    Replies:
    4
    Views:
    784
    Dan Pop
    Apr 2, 2004
  4. Replies:
    0
    Views:
    301
  5. Greener
    Replies:
    8
    Views:
    95
    Richard Cornford
    Oct 8, 2003
Loading...

Share This Page