🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2116

Static function prototypes and definitions

#2116
From: Lawrence H. Miller
Date: Mon, 12 Oct 1992 20:27
48 lines
1233 bytes
Several allegedly ANSI conforming compilers differ in how
static functions are to be specified in prototypes.

If I have a static function defined in a file, must the 
prototype also have the word static?  My reading of the
standard is that the word static is forbidden in block
scope declarations, but gnu C requires it.

If the word static is forbidden, is this really invalid:

	void f(void)
	{
	  static void g(void);
	  . . .
	  g();
	}

Is this correct:

	void f(void)
	{
	  void g(void);
	  . . .
	  g();
	}

Or is this required:

	static void g(void);

	void f(void)
	{
	  . . .
	  g();
	}

All assuming the file later contains a definition of g:

	static void g(void)
	{
	  . . .
	}


-- 
Larry Miller		The Aerospace Corporation
lmiller@aero.org	PO Box 92957		
310-336-5597		LA, CA 90009-2957
Technical Details
Message-ID: <1bcn2mINN680@news.aero.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!hela.iti.org!usc!news.aero.org!lmiller

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!hela.iti.org!usc!news.aero.org!lmiller
From: lmiller@aero.org (Lawrence H. Miller)
Newsgroups: comp.std.c
Subject: Static function prototypes and definitions
Date: 12 Oct 1992 20:27:02 GMT
Organization: The Aerospace Corporation, El Segundo, CA
Lines: 48
Distribution: world
Message-ID: <1bcn2mINN680@news.aero.org>
NNTP-Posting-Host: palomar.aero.org