Dead functions and /*NOTREACHED*/
Joe Buck
jbuck at epimass.UUCP
Fri Aug 22 02:54:23 AEST 1986
In article <86900019 at haddock> karl at haddock (The Walking Lint) writes:
>[discussion of some problems with adding "dead functions" to C]
>But I really hate having to write /*NOTREACHED*/ to keep lint happy!
There's a fix for this that doesn't do violence to the language.
There should be another "special comment" lint recognizes that's
present in the lint library (/*DEADEND*/ or something). Then
functions like "exit" are marked once in the lint library, and
user-written functions that always call exit would also be understood
to be "dead". Voila! lint now understands about exit, and is able
to find unreachable code that it currently may miss.
While I'm at it, a similar comment could be added to tell lint that
a function like malloc or calloc always returns an aligned pointer.
I understand that ANSI C has a different solution for this, but
every (void *) pointer isn't guaranteed to be aligned, so I suspect
that the ANSI solution will cause problems elsewhere.
--
- Joe Buck {ihnp4!pesnta,oliveb,nsc!csi}!epimass!jbuck
Entropic Processing, Inc., Cupertino, California
More information about the Comp.lang.c
mailing list