Re: Warn about ignored return codes

Alex Colvin <>
31 Aug 2005 00:33:46 -0400

          From comp.compilers

Related articles
Warn about ignored return codes (Markus Elfring) (2005-08-24)
Re: Warn about ignored return codes (Alex Colvin) (2005-08-31)
Re: Warn about ignored return codes (2005-08-31)
Re: Warn about ignored return codes (2005-09-02)
Re: Warn about ignored return codes (Dave Thompson) (2005-09-07)
| List of all articles for this month |

From: Alex Colvin <>
Newsgroups: comp.compilers
Date: 31 Aug 2005 00:33:46 -0400
Organization: The World : : Since 1989
References: 05-08-082
Keywords: testing
Posted-Date: 31 Aug 2005 00:33:46 EDT

>Some compilers can detect unused variables. Which tools can generate
>warnings for ignored return values from function calls in a similar
>way? How much can it help in static semantic checking and code
>analysis for flaw detection?

In a language like C (or LISP) functions often return some potentially
useful value, even if it's not a status. The function caller doesn't
always need this value.
strcpy() returns the destination address. The caller often already
knows this, having provided it.
printf() returns a status. It's easier to check ferror(). Or to
rely on the SIGPIPE exception

So it's common to ignore return values.

You could annotate functions to distinguish error returns from such
incidental value returns. You could also allow a printf status to be
discarded as long as ferror() is used. If you have enough dataflow
information you might be able to track error status flow.

mac the naf

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.