Re: Why leave the error handling to the caller?



Malcolm McLean said:

<snip>

No, the specification was to produce a function that filled out the
structure giving a list of strings, from an input consisting of a line
of strings separated by commas.

Separate the concept of a list of strings from the concept of input
parsing.

Now separate the concept of a list from the concept of a string.

Now the error handling is becoming manageable (you will recall that you
originally wrote that code to demonstrate that the error handling was a
PITN to write), and the program's complexity is being reduced as more
and more work is farmed out to re-usable library modules.

What you end up with is rather elegant (if done properly), and eminently
re-usable.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.



Relevant Pages

  • Re: Combobox help
    ... then put text strings as the ... > Hi Ken - I want ALL THREE options to display in the combobox as THREE ... > separate lines, and then I want the user to select ONE of the three ... >>> Sue Compelling ...
    (microsoft.public.access.forms)
  • Re: Symbols, metacircular evaluation, external representation.
    ... they treated as strings instead of a separate data type? ... a separate or more limited language to do your macros, ... I doubt that's all the application of external representations. ...
    (comp.lang.scheme)
  • Re: Search utility?
    ... Different text strings. ... Most web sites with search engines look for wordone OR wordtwo. ... Perhaps there is a way to search two separate strings in one pass. ...
    (comp.os.os2.apps)
  • Re: Why leave the error handling to the caller?
    ... of strings separated by commas. ... ptr - pointer allocated with malloc, ... Then if we put dlist_add into a separate file, suddenly we got a dependency, and the old problem of you want a list of strings and that requires pulling in a whole hierarchy of files. ...
    (comp.lang.c)