against enforce
spir
denis.spir at gmail.com
Fri Mar 25 20:10:18 PDT 2011
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?
Denis
--
_________________
vita es estrany
spir.wikidot.com
More information about the Digitalmars-d
mailing list