opImplicitCast/opImplicitCastFrom

bearophile bearophileHUGS at lycos.com
Sat Nov 1 18:08:41 PDT 2008


Janderson:
> Will bounds include subtypes /subranges AKA ADA?

I presume the answer is yes, because subranges of ranges/enums are often useful.

Another feature:

unsafe(integral, bounds, stack) {
    // here both array bounds, integral bounds and stack bound and aren't checked
    ...
}

Now that part of the program has stack bound checks too.

Note all such checks are already present in the current FreePascal (Open Source) compiler:
http://lazarus-ccr.sourceforge.net/fpcdoc/prog/progsu100.html
http://www.freepascal.org/docs-html/prog/progsu62.html

Just that the performance of FreePascal is quite similar to the performance of DMD (but for that performance you have to disable checks in the inner loops):
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=fpascal&lang2=dlang

Some links on related topics:
http://www.fefe.de/intof.html
https://buildsecurityin.us-cert.gov/daisy/bsi/articles/knowledge/coding/312-BSI.html
http://www.codeplex.com/SafeInt
http://www.ddj.com/security/193501774
http://www.boost.org/doc/libs/1_32_0/libs/numeric/conversion/doc/numeric_cast.html

Bye,
bearophile



More information about the Digitalmars-d mailing list