|Warn about ignored return codes Markus.Elfring@web.de (Markus Elfring) (2005-08-24)|
|Re: Warn about ignored return codes alexc@TheWorld.com (Alex Colvin) (2005-08-31)|
|Re: Warn about ignored return codes Markus.Elfring@web.de (2005-08-31)|
|Re: Warn about ignored return codes Markus.Elfring@web.de (2005-09-02)|
|Re: Warn about ignored return codes firstname.lastname@example.org (Dave Thompson) (2005-09-07)|
|From:||Alex Colvin <alexc@TheWorld.com>|
|Date:||31 Aug 2005 00:33:46 -0400|
|Organization:||The World : www.TheWorld.com : Since 1989|
|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 naïf
Return to the
Search the comp.compilers archives again.