Thread View: net.lang.pascal
3 messages
3 total messages
Started by Course Account
Sun, 20 Apr 1986 01:01
Berkeley Pascal grinds to a halt.
Author: Course Account
Date: Sun, 20 Apr 1986 01:01
Date: Sun, 20 Apr 1986 01:01
22 lines
1199 bytes
1199 bytes
While writing test programs for some student compilers, I found
a very short Pascal that makes the Berkeley Pascal get stuck in
its tracks. Here it is:
program main (output);
var
i, k : integer;
begin
i := 1;
k := i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+(i+i
)))))))))))))))));
writeln (i, k);
end.
This program takes over 400 seconds to compile on a VAX-11/780.
The time it takes doubles with each nested addition appended to the
expression. Thus pc's running time is exponential for expressions of
this sort.
Conclusion: If your compiles have been taking a long time, see if you
can reduce the nesting of parentheses.
Re: Berkeley Pascal grinds to a halt.
Author: koch
Date: Fri, 02 May 1986 11:27
Date: Fri, 02 May 1986 11:27
3 lines
690 bytes
690 bytes
on our vax 11/750 it is the same phenomene. but the program is executed very fast. miko, unido
Re: Berkeley Pascal grinds to a halt.
Author: Course Account
Date: Wed, 07 May 1986 01:43
Date: Wed, 07 May 1986 01:43
2 lines
649 bytes
649 bytes
The times given were for Berkeley 4.2 UNIX. Apparently the problem has been corrected in 4.3.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads