The Windows API translation project has gone quiet

Stewart Gordon smjg_1998 at yahoo.com
Mon Dec 4 04:13:13 PST 2006


Serg Kovrov wrote:
> Speaking of translation... I wonder what purpose of fixed arrays of 1 
> element? Such as BYTE[1] (vs just BYTE).

They're a kludge to have a structure immediately followed by an array in 
memory.  The idea is that you allocate enough memory to contain the 
struct plus the array members beyond the first, and then access the 
array through the BYTE[1] member.

Because D has array bounds checking, which screws up this idea, the 
practice has been to translate these by naming the one-element array 
itself with a leading underscore and then defining a getter to turn this 
into a pointer.  There's been a bit of a debate about which approach to 
use - see the more recent thread "Getting back into translating the 
Win32 headers - anyone?"

Stewart.



More information about the Digitalmars-d-announce mailing list