On 01/31/2006 02:37 PM, Howie Goodell wrote:
The test "i<limit" fails where 16-bit math or huge loops hit the
signed-arithmetic threshold. Using unsigned arithmetic only buys you
another power of 2. The safe approach is to say, "limit-i<1".

Oh, sure.  I just didn't want to complexificate the example by
introducing issues of machine representation and wraparound,
let alone handling signalling NaNs or sign extension.

"i<>0" fails much more insidiously if your language only has floating
point variables.  Then "i=limit" might *never* be true, depending on
how it was calculated, or else fail sporadically. I once used an
environment where the multitasker saved only 64 bits of floating-point
numbers, not the 80x86 FPU's 80 bits. So equality tests worked as
expected *almost* always, except for rare combinations of iterator
value and thread synchronization.;-(

<python-mode accent="Yorkshire">

Well, *I* once worked with a system that obliged you to
push numbers onto a stack, but the garbage collector might
fire mid-push, and happily collect the very number you were
pushing, precisely because the only reference to it was in
a CPU register, leaving you with a lovely new reference
to anything at all, except your number.  So a program
would work >>99% of the time, and then go all doo-lally,
usually when a manager was looking.  And the problem wasn't
in your source, so there was no point looking there to find it.

I had to get up two hours before I went to bed to find that
bug, and my boss had me executed even though it wasn't in my code.

Kids today, don't know they're born.

</python-mode>

I propose that the answer to "Should we teach better or use safer
programming constructs?" is also, "Yes."  I'm revising an embedded
end-user programming environment now. This thread just convinced me to
add "foreach" to it.;-)

There's nothing quite like creating tools for other programmers
whose code will then be burned into ROMs.  (Four such ROMs of
mine are on eBay now.  I am not making this up.)

The answer to: "does this concentrate the mind wonderfully, or
drive you potty?" is "Yes."  Plus, you learn how to dodge missiles
thrown from nearby desks, a valuable skill that is sadly neglected
in our schools since I left them.
--
Frank Wales [EMAIL PROTECTED]

----------------------------------------------------------------------
PPIG Discuss List (discuss@ppig.org)
Discuss admin: http://limitlessmail.net/mailman/listinfo/discuss
Announce admin: http://limitlessmail.net/mailman/listinfo/announce
PPIG Discuss archive: http://www.mail-archive.com/discuss%40ppig.org/

Reply via email to