1. For a C99-compliant preprocessor,
#ifdef X and
#if defined(X) are 100% synonyms.
2. #ifdef _WIN64
BYTE bReserved[6];
#else
#if defined(_WIN32)
BYTE bReserved[2];
#endif
#endif
The array of bytes
BYTE bReserved[n]; is used in this UDT (
typedef in C parlance) for aligning its member fields on the machine-word boundary (4 bytes under x86, and 8 bytes, under x64).
Such a tree of preprocessor conditionals has
three distinct branches:
- if the _WIN64 preprocessor internal flag is defined under x64, the preprocessor is supposed to insert BYTE bReserved[6];
- if the _WIN32 preprocessor internal flag is defined under x86, the preprocessor is supposed to insert BYTE bReserved[2];
- if none of those flags are defined, for example under WinCE, the preprocessor is supposed to omit the alignment bytes from the structure declaration altogether.
3. OxygenBasic is (currently) designed to operate in
_WIN32 and
_WIN64 environments only therefore its preprocessor has to consider a two branch only choice and Charles' preprocessor directive is respectively simpler. It is supposed to use the alignment byte array either way and it only needs to change the array size placeholder
n in between the square brackets to a numeric literal (either
2 or
6) as appropriate for the current platform.
4. OxygenBasic
sys is an integer whose size adjusts itself automatically to 32 bits or 64 bits depending on the current platform. It is used in Charles' typedef to store the actual numeric values of the pointers
DWORD_PTR and
INT_PTR which may require up to 32 or 64 distinct non-zero bits in any random combination to be expressed correctly on the respective platform. So, you don't have to manually precise the size of these pointers in O2 specifically because
sys would expand or shrink automagically by O2 design.