If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Which hold a huge string. I just checked how much time that thing has to loop before writing the string and it's amasing. It loops 69606 times before having the correct string to write.
You're right Chuck. You can do any recursive algorithm iteratively. I was wrong, not sure what I was thinking of at the time. Still, it doesn't mean that the iterative approach will be better.
And I don't use the ternary much either, but it has it's uses. Some compilers can/will optimise it very effectively, and it has different precedence than if/then/else, which can improve the readability of some code (the example escapes me, but there's a classic in C where it cuts out a couple pairs of parentheses).
Gigabyte P35-DS3L with a Q6600, 2GB Kingston HyperX (after *3* bad pairs of Crucial Ballistix 1066), Galaxy 8800GT 512MB, SB X-Fi, some drives, and a Dell 2005fpw. Running WinXP.
I untangled all the ?: into if exept one.... the first one on the first line. It compile without error/waning but it only display the fisrt line of the string probably because the function loops without being able to reach the condition (that i have removed) to run backward and display the others.
I'll see if I can find a copy I worked on.
It ran correctly even if not all the ?: were converted.
Maybe it will help.
I don't think of programs like this a s looping.
I think of them as diving down through the stack leaving bread-crumbs along the way so they can find their way back
It's ok, i just misplaced one of my else somewhere.
Well even if there's no loop, it loop's in a way by recalling itself... but your right it's not a true loop.
Comment