3 ms·
Is the zlist version even re-entrant?
by twoodfin 11y ago
Is the zlist version even re-entrant?
- jasode 11y agoThat's also a good point. You can't use zlist* functions in recursive algorithms in single-threaded code. Whether such recursive code would be an artificial contrivance or a real-world misuse is something left to the reader's imagination. I notice that the zlist_copy() function was deprecated so you'd have to do something else if you wanted to pass a copy of a new "list" to subsequent recursive calls. I didn't dig deeper into the czmq documentation to find out what the recommended guidelines would be. (Although we'd guess that any copy operation would be O(n) and therefore thinking in terms of recursion would be an antipattern for czmq.)
- bluski 11y agoYou don't need recursion to hit the wall - how about comparing all pairs of elements? I.e. inner loop that iterates over all elements once again.
- PieterH 11y agoIt's zlist_dup() and you would not use recursion to process these types of lists. The API is designed for iteration. One case for recursion is when you use lists of lists of lists... you can then process such structures recursively. See zconfig for examples of that.