checkedint call removal

via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 30 05:52:24 PDT 2014


On Wednesday, 30 July 2014 at 09:12:56 UTC, bearophile wrote:
> And assume() and assert() are two different things, used for 
> different purposes. Do not give the same name to two so 
> different features, if you want to keep a language sane.

Exactly. If you want to establish that the provided input is 
never zero and that the program doesn't need to be correct in 
that case, you do this:

assume(input!=0);

If you want to specify that the input should be prevented from 
being zero, you do this:

if(input!=0){
   assert(input!=0);
}


More information about the Digitalmars-d mailing list