Article View: comp.lang.prolog
Article #897Re: Proof that Prolog can be faster than C
From: Vinod Grover
Date: Sat, 16 Jun 1990 00:31
Date: Sat, 16 Jun 1990 00:31
16 lines
1325 bytes
1325 bytes
In article <1990Jun15.205242.16314@agate.berkeley.edu> dankg@volcano.Berkeley.EDU (Dan KoGai) writes:
>In article <36986@ucbvax.BERKELEY.EDU> vanroy@pisces.uucp () writes:
>a1, a2, a3 to waste space and time. try the following.
>
>int tak(int x, int y, int z)
>{
> return (x <= y) ? z : tak(tak(--x, y, z),tak(--y, z, x),tak(--z, x, y))
>}
This program has a missing semicolon, and runs into an infinite loop.
C does not require the side-effect in --x to happen immediately. You must
force the subtraction. Furthermore, eliminating explicit temp variables does
not mean that the compiler won't put them back in. However, declaring those
explicit temps to be register variables *may* improve the program, but is
not guarenteed to do so.
Vinod Grover
Technical Details
Message-ID:
<137408@sun.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!samsung!usc!apple!sun-barr!newstop!sun!brahmand.Eng.Sun.COM!groverReferences:
<36986@ucbvax.BERKELEY.EDU> <1990Jun15.205242.16314@agate.berkeley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!samsung!usc!apple!sun-barr!newstop!sun!brahmand.Eng.Sun.COM!grover From: grover@brahmand.Eng.Sun.COM (Vinod Grover) Newsgroups: comp.lang.prolog,comp.lang.c Subject: Re: Proof that Prolog can be faster than C Keywords: Prolog, tak Message-ID: <137408@sun.Eng.Sun.COM> Date: 16 Jun 90 00:31:02 GMT References: <36986@ucbvax.BERKELEY.EDU> <1990Jun15.205242.16314@agate.berkeley.edu> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 16