>But this leads to a big loss in compile-time error checking,
>similar to the disaster that is Windows. Here's an example:
(nice random dig against Windows, but it has nothing to do with Windows
being whatever kind of disaster you feel it to be <g>).
>typedef void * HWND;
>typedef void * HDC;
sorry, my bad. the Win32 headers do not use void*. they define structs:
typedef void *HANDLE;
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct
name##__ *name
DECLARE_HANDLE (HWND);
DECLARE_HANDLE (HDC);
>extern void DoSomething ( HWND hWnd, HDC hDC );
>
>void foo () {
> HWND hWnd;
> HDC hDC;
>
> DoSomeThing ( hWnd, hDC ); // correct
> DoSomeThing ( hDC, hWnd ); // wrong, but no compiler will complain
> }
uhhh, i get compiler warnings. are you sure you have the warning levels
high enough? either that, or for some reason you aren't using the #define
STRICT (whose whole purpose is to make the compiler give errors all over the
place for anything you might be doing wrong).