Anyone any clue as to why there is an uppercase
VOID macro defined in the
To make matters more confusing,
VOID is a macro, whereas
LONG are typedefs.
See the relevant excerpt from
#ifndef VOID #define VOID void typedef char CHAR; typedef short SHORT; typedef long LONG; #if !defined(MIDL_PASS) typedef int INT; #endif #endif
A historical reason perhaps for doing
VOID* pointer instead of
EDIT: What is even more troubling is to see people using
VOID instead of
void when doing Windows programming today. You can also see it as part of MSDN docs, e.g. http://msdn.microsoft.com/en-us/library/bb205867(v=vs.85).aspx
The original reason is that the Win32 API was originally supposed to be language independent, so they made up their own names (following their naming convention), and then provided a C implementation of that. In reality, much of what they defined tends to be ignored by most people using other languages (and largely even by people using C, for that matter).
As far as why
VOID is a
#define instead of a
typedef, that's pretty simple: the required
typedef would be
typedef void VOID;, but C (edit: as "defined" by Microsoft's C compilers from that time) simply doesn't allow that, so they use a macro instead.
The Windows API is old. Really old. Older than the official C standard old.
This means that, at the start, the Windows API had to deal with all kinds of ancient C compilers, with different levels of language support. Some might not support
void. Some might have an
int type that's not compatible with what windows thought was
int. Some might not understand
short. As a workaround, the Windows API provides upper-case portable equivalents that are aliased to whatever works for that particular compiler.
Of course, with modern compilers, things have settled down quite a bit. Everyone supports
void, for example. However, in order to maintain compatibility with old code that uses these upper-case macros, the
typedefs have to remain.