against enforce
Jonathan M Davis
jmdavisProg at gmx.com
Fri Mar 25 20:31:20 PDT 2011
On 2011-03-25 20:10, spir wrote:
> On 03/25/2011 11:20 PM, Jonathan M Davis wrote:
> > In the case of something like dividing by 0 or other math functions that
> > could be given bad values, the typical solution is to either use an
> > assertion (or check nothing) and then let the caller worry about it. It
> > would be extremely wasteful to have to constantly check whether the
> > arguments to typical math functions are valid. They almost always are,
> > and those types of functions needto be really efficient.
>
> But catching wrong arguments to math functions at *runtime* is precisely
> what D itself does (as well as all languages I know):
>
> auto a = 1, b = 0;
> auto c = a/b;
> ==>
> Floating point exception
>
> There is no way out, or do I miss a point?
Don would know better than I do, but I believe that that is a CPU thing there.
D isn't doing that. The CPU is.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list