I'm checking out the context code from the PDSN library, and came across this:
in function fetchContextPage in file proSIserver.p:
DO WHILE ContextStore.SessionID = "" AND
ContextStore.ContextID = pcContextID AND
ContextStore.ContextName = phPageTable:NAME AND
ContextStore.RowSequence < iStartSeq + piPageSize:
/* stopped coding here... */
END.
I'm thinking this looks an awful lot like an infinite loop....
Why?
Seems like this clause would certainly limit the number of rows:
ContextStore.RowSequence
Not to mention that, even without that, there are only going to be so many records in ContextStore which qualify:
ContextStore.SessionID = "" AND
ContextStore.ContextID = pcContextID AND
ContextStore.ContextName = phPageTable:NAME
Ummm - there's nothing inside the loop to change any of those values...the comment is the only "code" between the DO WHILE and END.
Either the loop is skipped completely because the AND conjunctions fail, or it never leaves.
Ah, so you are saying that the comment is the only content of the loop and there is nothing to advance to the next record?
The corresponding procedure in AutoEdge looks like this:
--
Ah, so you are saying that the comment is the only content of the loop and there is nothing to advance to the next record?
Exactly.
Hopefully, the version from AutoEdge makes a bit more sense!
Hopefully, the version from AutoEdge makes a bit more sense! :)
I can only guess - this code isn't supposed to actually do something, just illustrate a principle...
Was that the principle of how to use up as many CPU cycles as possible?
The AutoEdge version makes a certain intuitive sense to me, just from the dictionary, but I haven't studied it enough yet to see whether or not I agree with the design.