🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9174

Dead functions and /*NOTREACHED*/

#9174
From: Joe Buck
Date: Thu, 21 Aug 1986 16:54
21 lines
1659 bytes
In article <86900019@haddock> karl@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
Technical Details
Message-ID: <410@epimass.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ll-xn!nike!oliveb!epimass!jbuck
References: <273@watmath.UUCP> <86900019@haddock>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ll-xn!nike!oliveb!epimass!jbuck
From: jbuck@epimass.UUCP (Joe Buck)
Newsgroups: net.lang.c
Subject: Dead functions and /*NOTREACHED*/
Message-ID: <410@epimass.UUCP>
Date: Thu, 21-Aug-86 12:54:23 EDT
Article-I.D.: epimass.410
Posted: Thu Aug 21 12:54:23 1986
Date-Received: Thu, 21-Aug-86 21:26:39 EDT
References: <273@watmath.UUCP> <86900019@haddock>
Reply-To: jbuck@epimass.UUCP (Joe Buck)
Organization: Entropic Processing, Inc., Cupertino, CA
Lines: 21