| | |
Help decoding line of typedef/struct combo
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
I'm from a C background and need help with the following lines of code
Thanks
C++ Syntax (Toggle Plain Text)
struct IGame { // Summary // Entry function used to initialize a new IGame of a GameMod // Parameters // pGameFramework - a pointer to the game framework, from which a pointer of ISystem can be retrieved // Returns // A pointer to the newly created IGame implementation typedef IGame *(*TEntryFunction)(IGameFramework* pGameFramework); . . . .
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
Mods: Couldn't edit so i added another post.
Why would any one want to typedef a simple struct with that maze of brackets and stars.
Could you please tell me the meaning of
The above to me, looked like a function call with no void argument.
Why would any one want to typedef a simple struct with that maze of brackets and stars.
Could you please tell me the meaning of
C++ Syntax (Toggle Plain Text)
typedef IGameFramework *(*TEntryFunction)();
Last edited by d0pedup; Jan 19th, 2009 at 7:02 am.
•
•
Join Date: Dec 2007
Posts: 360
Reputation:
Solved Threads: 69
•
•
•
•
Mods: Couldn't edit so i added another post.
Why would any one want to typedef a simple struct with that maze of brackets and stars.
Could you please tell me the meaning of
The above to me, looked like a function call with no void argument.C++ Syntax (Toggle Plain Text)
typedef IGameFramework *(*TEntryFunction)();
TEntryFunction is a pointer to a function taking no argunemts and returning a IGameFramework pointer.
If you are forced to reinvent the wheel at least try to invent a better one!
Please use code tags - Please mark solved threads as solved
Please use code tags - Please mark solved threads as solved
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
•
•
•
•
No, it is a type declaration of a function pointer:
TEntryFunction is a pointer to a function taking no argunemts and returning a IGameFramework pointer.
So the return value would be of the type IgameFrameWork* and the return value would be assessable via a IgameFrameWork* pointer right..?
Last edited by d0pedup; Jan 19th, 2009 at 9:13 am.
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
Needed to brush up on my function pointers, haven't really used them at all.
Found a neat article that might be of help
http://www.devx.com/tips/Tip/13829
Found a neat article that might be of help
http://www.devx.com/tips/Tip/13829
![]() |
Other Threads in the C++ Forum
- Previous Thread: A shoot function with DarkGDK
- Next Thread: DarkGDK macros
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





