Closed jdobber closed 12 years ago
this can't be compiled on 32-Bit anymore!
(Linux ibmX32 3.0.0-15-generic #26-Ubuntu SMP Fri Jan 20 15:59:53 UTC 2012 i686 i686 i386 GNU/Linux)
Maybe conditional compilation must be used here to determine the target platform. See: http://www.d-programming-language.org/version.html
silvio@ibmX32:~/Desktop/pird$ make
dmd *.d c/cdio/*.d readers/*.d writers/*.d sources/*.d -ofpird \
-L-lcdio -L-lcdio_cdda -L-lcdio_paranoia -Jusages \
-L-L/opt/local/lib \
-w \
-version=devel
utils.d(40): Error: cannot implicitly convert expression (length) of type ulong to uint
utils.d(43): Error: function core.stdc.string.strncpy (char* s1, const(char*) s2, uint n) is not callable using argument types (char*,char*,ulong)
utils.d(43): Error: cannot implicitly convert expression (length) of type ulong to uint
make: *** [pird] Fehler 1
OK, I tried to find a solution and got one.
The version approach would look like this:
version(X86)
{
int length;
}
version(X86_64)
{
ulong length;
}
and so on for every Platform. But this can't be the right solution. Regarding the http://www.d-programming-language.org/portability.html guide, the _sizet type should be used for unsigned integral types --- and it works.
Man lernt eben nie aus ;)
just for information, another solution for this would be:
T bufferTo( T )( char[] buffer )
{
char[] tmp;
- size_t length;
- length = strlen( cast( char* )buffer );
+ auto length = strlen( cast( char* )buffer );
tmp.length = length;
...
some changes are needed to compile under OSX and other 64-Bit systems