pure functions cannot be removed, actually: pure vs. total
Stefan Koch
uplink.coder at googlemail.com
Thu Jun 7 22:57:32 UTC 2018
On Thursday, 7 June 2018 at 22:23:09 UTC, Steven Schveighoffer
wrote:
> {...}
That a function could return does not mean it will.
int fn (int arg) /*strongly*/ pure
{
if (arg == 42)
return 42;
else (arg < 43)
return fn(--arg);
else
return fn(++arg);
}
do you see the problem?
If not you would you expect the compiler to ?
note: I would expected that the clang static analyzer
would be able to determine that depending on the value of arg
this function might never return.
More information about the Digitalmars-d
mailing list