|
-
Oct 29th, 2001, 02:11 PM
#1
Strange HWND...
did anyone notice before how the DECLARE_HANDLE macro works? It is used to declare the handle data types and is defined as follows:
Code:
#define DECLARE_HANDLE(name) \
struct _##name {int unused; }; typedef struct _##name * name;
Does anyone have an idea why MS uses that weird way to declare handles?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 29th, 2001, 02:19 PM
#2
transcendental analytic
probably so that handles won't mix up with implicit cast, they use a lot of macros as shortcuts for declarations which makes it harder to read it unless you have read it all trough once.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 29th, 2001, 02:27 PM
#3
There is actually a big rant going on over on GameDev.net on this sort of thing. The code you posted is in "#ifdef STRICT" pre processor tags. If STRICT is not defined, all HANDLE types (HWND, HDC, etc) are typedefed to HANDLE which is void*. So, when a function calls for an HDC, and STRICT is not defined, you can pass an HWND if you wanted, and the compiler wouldn't yell. If STRICT is defined, all HANDLE types (except HANDLE, its still void*) are now structs, and the compiler will yell if you mix them up.
Z.
-
Oct 29th, 2001, 02:29 PM
#4
transcendental analytic
What do they say there Zaei? I'd say STRICT
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 29th, 2001, 02:32 PM
#5
why would anyone not use STRICT?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 29th, 2001, 03:18 PM
#6
Monday Morning Lunatic
I used STRICT since I found out about it
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|