| | |
Help decoding line of typedef/struct combo
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 6: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 8: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
Views: 482 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C++
algorithm array arrays assignment basic beginner binary c++ c++borland c/c++ calculator char class classes client code compile compiler constructor conversion convert count delete dll dynamic encryption error file files form fstream function functions game givemetehcodez graph gui helpwithhomework homework http i/o iamthwee input int integer lazy library link linker list loop loops math matrix member memory multidimensional newbie news number numbers object objects opengl output parameter pointer pointers problem program programming project qt random read recursion recursive reference search sort spoonfeeding string strings struct student studio template templates text time tree variable vc++ vector video visual win32 window windows winsock





