On 8/19/2012 8:18 AM, Peter Alexander wrote:
Personally, I'd prefer option 1. Walter's argument is that this "leads to the
programmer getting annoyed with false positive error diagnostics, and he'll
likely add an =0", which is true, but in my opinion this scenario is quite rare
to start with, and it's even more rare that 0 isn't actually the right
initialisation value, and even then it's only a problem if the introduced bug is
hard to reproduce.

Rare, yes, it's rare. But it's really ugly and hard to find when it does happen.

> I find it more likely that the NaN will go unnoticed and
> cause rare bugs.

NaNs in your output are pretty obvious. For example, if your accounting program prints "NAN" for the amount on the payroll cheques, someone is guaranteed to notice. But if it's a few cents off in your disfavor, it might take you years to discover there's a problem.

Critical systems also would find a NaN command a lot easier to detect than an off-by-two command, and would be able to shut down and engage the backup.

Reply via email to