[prog] C programming - capturing information sent to stdout

Sue Stones suzo at spin.net.au
Thu Jul 14 13:08:31 EST 2005


Thanks Mary, I did understand your point from the start, in fact you 
made it clearly enough for it to be obvious.     It was the borderline 
case that I couldn't understand.  Having said that I probably don't 
understand large projects well, so your extra comments were still useful.

Mary wrote:

>On Thu, Jul 14, 2005, Sue Stones wrote:
>  
>
> So, I guess my position is really that asserts aren't all that useful in
>
>complex programs for the case of "oh wow, something's gone wrong with
>the way I was used" because users of complex programs are likely to want
>behaviour more complex than "everything disappears with short error
>message about an assertation failing."
>
>The situation you want to use them in: to slightly simplify the code in
>a situation where you are pretty much doing "print error, die
>immediately" anyway sounds OK. But "print error, die immediately" is
>*all* that assert does.
>
>As far as I can see, situations where you want "print error, die
>immediately" are:
> - during development when you want to find the error and eliminate it
> - in simple programs like scripts that read in a file and do something
>   with it
>  
>
Print error message and die is *all * I want to do, and as far as I know 
is the standard response in this sort of situation.  This is not a user 
interface, its not a direct response to a user's actions.    I fully 
expect the user, when faced with an error message that it couldn't open 
a file, to be "What would it want to open a file for?"    But it is not 
looking for programmer error either. If assert generates a core dump (as 
Kathryn says) then that is *more* than I want to do. 

It sounds like this is not really a situation where assert is used.  It 
seems like assert is best reserved for checking for programmer errors.  
Thanks for helping me sort this out.

sue




More information about the Programming mailing list