Attempt at DWT 64 bit port

ed via Digitalmars-d-dwt digitalmars-d-dwt at
Mon Jun 23 17:30:56 PDT 2014

I'm attempting a 64 bit port of DWT and I'd like some feedback on 
API changes.

My initial preference was no changes to existing API in order to 
ease future updates from SWT proper. But of course that requires 
casts and I suspect they will bubble to the surface and be 
exposed to end-users of DWT.

So now I'm leaning towards API changes of this sort:

     /// Extension to String
     public int indexOf( in char[] str,
                         char searched,
                         int fromIndex ){cast(int)...cast(int)...}


     /// Extension to String
     public ptrdiff_t indexOf( in char[] str,
                               char searched,
                               ptrdiff_t fromIndex) {...}

This maintains sign compatibility with the original API but may 
require some changes to existing code. For example:

// Fails 64 bit, works 32 bit
int idx = indexOf("astring", 't', 1);

  // Works 64 bit, Fails 32 bit
long idx = indexOf("astring", 't', 1);

// Works 64 bit and 32 bit
auto idx = indexOf("astring", 't', 1);

Does anyone have an alternative preferred approach to portable 
32/64 bit code?

One possibility is separate code bases for 32 and 64 bit, as per 
SWT proper. This is not my preference but I am happy to do it if 
people feel it would be better this way.


More information about the Digitalmars-d-dwt mailing list