Re: Can i get your opinion? [TL;DR post].
Posted: Mon Nov 29, 2010 2:07 am
As someone who's currently studying the win32 api, I'd just like to mention this. A common theme I've seen in a few apis I've looked at is to use typedef to make the api easier to understand. For example, the GetMessage function returns BOOL. BOOL is really just a typedef of int. That way in addition to returning a true(1) or false(0) result the function can also return an error(-1). If a function returns BOOL then you know that normally it will return a true or a false result, but that it could (not every function of type BOOL will) also return an error. Data types like HINSTANCE and HWND are really just typedefs of void pointer, but with the typedef you have a better understanding of what a variable is going to be used for and what kind of object a function needs run.
Which version of this function do you find easier to understand?
If you're relatively new to C/++ programming then you could learn quite a few cool programming techniques by studying win32, but that's not to say you couldn't learn them by learning another api.
Which version of this function do you find easier to understand?
Code: Select all
int ShowWindow(void*, int);
BOOL ShowWindow(HWND, int);