Compiled dmd2.032 in VC++ 2009!

bearophile bearophileHUGS at lycos.com
Sun Sep 6 05:40:05 PDT 2009


Jeremie Pelletier:
>I usually test for the string length before slicing it.<

Me too, but:
- mammals aren't perfect, and sometimes they forget things, etc. A compiler, once well programmed, will not forget such tests.
- such tests added by me and you slow down code a little (but a good compiler can remove some of them, GCC and LLVM are able to). This may mean that the time saved by D slices being non-saturating (unlike Python ones) may be spent anyway by tests added manually by the programmer. If this is true (and I think it may be true, I'd like to instrument LDC to run a slicing-heavy D program with and without saturation in slice bounds to test if I am right here) then the saturating nature of Python slices is better under all points of view, nearly efficiency-neutral too :-)

Bye,
bearophile



More information about the Digitalmars-d mailing list