Compile time function execution...

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Feb 16 01:45:30 PST 2007


Walter Bright wrote:
> Whether you tell it to fail at a smaller limit, or it fails by itself at 
> a smaller limit, doesn't make any difference as to whether it runs on a 
> less powerful system or not <g>.

I'd definitely prefer a way to make it fail early. When I was first 
trying out v1.006 I modified the sqrt() example to an infinite loop, and 
made the fatal mistake of switching focus away from my terminal window. 
My system ground to a halt as DMD tried to allocate pretty much all free 
memory + swap. (That's over 2 GB!) It got so bad it took a few minutes 
to switch to a virtual console and 'killall dmd'. And even after that it 
was slow for a while until the running programs got swapped back in...
Surely it would have been possible to detect something having gone 
horribly awry before it got this bad?

> If your system is too primitive to run the compiler, you use a cross 
> compiler running on a more powerful machine.

My system is an AMD Sempron 3200+ with 1GB of RAM...

> I have thought of just putting a timer in the interpreter - if it runs 
> for more than a minute, assume things have gone terribly awry and quit 
> with a message.

This might be a good idea, but perhaps make the time depend on a 
command-line switch, and maybe add something for memory usage as well?



More information about the Digitalmars-d mailing list