Book a Demo

Author Topic: Function pointer type definition  (Read 12511 times)

chris_

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Function pointer type definition
« on: August 12, 2011, 10:08:37 pm »
Hello everybody,

I try to model the different own type definitions  that I am using. But I just have a problem with function pointers...
How could I represent the type definition of a function pointer?

Example: typedef int (*myPtFct) (int*);

Have someone an idea?

thanks

Chris

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Function pointer type definition
« Reply #1 on: August 17, 2011, 11:40:28 am »
First question that comes to mind is;
Q. Have you tried writing the code and reverse engineering it into EA to see how it maps?

The other thought I have is you could model it as a class if your using C++ and define it as an attribute. Its been over 12 years since I've written C++ so I'm a little rusty but I think it was James Coplien's book on advanced C++ and idioms or even one of Stroustrups C++ books that describes using a more object oriented approach using polymorphism and virtual functions instead of function pointers. There is a little overhead.

Alternatively just model it as a data type.

It really depends on why you want to model it and hope to gain from it.
Happy to help
:)