www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - portability tips

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

While reviewing Phobos for 64bit systems I noticed two very common
coding problems.

1) If you use conditional compilation(version/debug/static if), always
add a sanity check.



version(Windows){
	...
}

version(linux){
	...
}



version(Windows){
	...
}else version(linux){
	...
}else{
	pragma(msg, "didn't yet adapt ....");
	static assert(0);
}

2) Reevaluate your use of signed, unsigned integers and their size for
iteration purposes - especially as array indexes or pointer offsets.

Maybe size_t and ptrdiff_t are better suited than int/long and uint/ulong?

Thomas
-----BEGIN PGP SIGNATURE-----

iD8DBQFDMtII3w+/yD4P9tIRAlaQAKDGGVKvbOrACom30GiOuSPCGnUoJACgp5dS
u6mBlFxA8cfoOmS02MD02Bs=
=RNtP
-----END PGP SIGNATURE-----
Sep 22 2005