|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
10-15-2008 01:25
From: Talarus Luan That's an interesting idea though.. keeping everything event-driven with no way to do a loop construct. Though I think I would still like to have a loop construct, just would like to have a smarter compiler which could point out whether it is infinite, or has the potential for becoming so. When the compiler, interpreter, and the control system it was controlling had to fit in a couple of 2764s, that would have been a trifle hard to manage.
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
10-15-2008 02:17
I almost got involved in compiler R&D once... would've loved that job... but ended up elsewhere. Anyway, I've seen a modern compiler that would spot some obvious infinite loops, such as this classic mistake I made in C++ once (in my undergrad days): for (unsigned int i = 10; i >= 0; i--) { // do something.. }
(For anybody unfamiliar with the concept, an "unsigned int" is incapable of expressing values less than 0. When that loop reaches 0 and tries to decrement "i", it simply wraps all the way back round to about 4 billion, so it never becomes negative, so the loop never terminates. Meh, that stack memory was underused anyway...)
|