Lambda the Ultimate

inactiveTopic The crapness that is the Win-32 API
started 11/1/2002; 10:19:09 PM - last post 11/8/2002; 2:36:35 PM
Michael Mounteney - The crapness that is the Win-32 API  blueArrow
11/1/2002; 10:19:09 PM (reads: 415, responses: 2)
BOOL ReadFile (HANDLE, ...);

I wrote:

result = ReadFile(file_handle().MS_handle, ...);

where I meant:

result = ReadFile(file_handle().MS_handle(), ...);

but because a HANDLE is just a void *, it accepts just about anything without complaint. Gah ! Is this Microsoft's fault for being lazy, or C's for letting them ?

Yet another argument for strong typing (which C is not).

Dan Shappir - Re: The crapness that is the Win-32 API  blueArrow
11/3/2002; 2:09:51 AM (reads: 378, responses: 0)
Is Win32 bad - yes it is.

You must remember, however, that Win32 is directly derived from Win16, that simple "OS API" provided by Win3.1, Win386 and the likes. While MS has enhanced the API significantly (in many ways that have little to do with the move from 16-bit to 32-bit) the crappy core remains - it must in order to retain backward compatibility.

Another thing you should be aware of is that the Win32 API is dead, Don Box said so. MS is actively pushing Windows developers away from the Win32 API towards .NET . Actually this process started long before .NET with such marvels of design as MFC.

Finally, Win32 originally defined almost all handle types as void* . Subsequently they introduced the STRICT preprocessor definition, which resulted in the different handles getting a different type. Because this definition could break old code, it wasn't used by default. Starting with VC6 (as I recall) this definition is placed by default in new projects. I don't recall HANDLE's definition, but you should make sure that your project defines STRICT.

Michael Mounteney - Re: The crapness that is the Win-32 API  blueArrow
11/8/2002; 2:36:35 PM (reads: 317, responses: 0)
Thanks for that. I didn't know about -DSTRICT and, although it didn't throw up any problems, it was worth adding.

How do I get started with .NET ?