about | join |
login
4%
“Most important, it reads from top to bottom, by which I mean that
each step follows from the preceding step, and the code stops as soon as it
knows the answer. It tells a simple story:

If you want to find an element of tab->item with name==arg,

  • First check that tab points to something.
  • Then check each element of the pointed-to array, returning if you find a match.
  • If you didn't find it, it's not there.


The old version of the story is extremely roundabout:

If you want to find an element of tab->item with name==arg,

  • First, assume its not there.
  • Then check that tab points somewhere. If so

    • go through the array until you see what you're after.
    • When you're done looking, you found a match if and
      only if you didn't go through the whole array.

  • Having done all that, inform the caller about what you determined.


source...
posted 1 month ago in programming, go1 view | 1 jaa | reply )

about | blog | faq | privacy

© 2008 jaanix, inc.