[<<][c][>>][..]
Tue Apr 5 21:15:28 EDT 2011
"for" functions or "FOR" macros?
The idea is to always use abstract collection traversal interfaces.
There are essentially two forms:
- the STREAM: open, close, next, eof
- the early-abort FOR loop, either as a macro or as a higher order
function (callback + state).
Most people are familiar with the STREAM option, but the FOR function
has some advantages, such as centralizing resource allocation
(open/close are abstract).
In C, a "FOR" macro is more convenient since it can use its
surrounding lexical context without using tricks, but a "for" function
is more powerful though a bit clumsy to use for its need of specific
"context" structures (closures).
[Reply][About]
[<<][c][>>][..]