against enforce

spir denis.spir at gmail.com
Sat Mar 26 05:53:33 PDT 2011


On 03/26/2011 04:31 AM, Jonathan M Davis wrote:
> 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.

All right!

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list