|
![](/i/fill.gif) |
Warp wrote:
> It saves checking the node type for each single operation you do to any
> node in the list. It the node is a struct, its contents are fixed and thus
> you don't have to check anything.
If the node is a struct, you still have to check if it's the end of the list
or a leaf of the tree. You still have to do the equivalent of the text in
if (node->next != NULL) ...
In any case, this checking process is built into the syntax of the language.
That (and more) is what is meant by "pattern matching" constructs. So
checking the tag on the union (so to speak) is done in a type-safe way with
pretty much the same amount of work as checking for a NULL pointer.
--
Darren New, San Diego CA, USA (PST)
Serving Suggestion:
"Don't serve this any more. It's awful."
Post a reply to this message
|
![](/i/fill.gif) |