🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #122

Function Prototypes: Don't they force casts?

#122
From: Test Account
Date: Sun, 26 Jul 1992 08:22
34 lines
1675 bytes
Howdy:
	While I was completeing the port of my application to ANSI-C, I came
across this:

#include <signal.h>
#include "myproto.h" /* This included many prototypes, but of particular
interest here is: void memory_fault(void); */

[...]

	if ((int) signal(SIGSEGV, memory_fault) < 0) {
		perror("Trouble initializing SEGV routine");
		exit(-1);
	}

Under AIX 3.2 using c89, this produces a diagnostic about incompatible types:
int and pointer (don't have the exact text handy, but I hope you get the
idea). This occurs IFF memory_fault() is declared AFTER its use or in another
module, if it is declared before its use there is no diagnostic. The fix is
simple, ((void *) memory_fault) works fine but I THINK that it is unnecessary.

Now I know that a conforming implementation is allowed to issue any spurious
diagnostics that it wishes to but ...

Am I all wet here or should I make a call to IBM to ask for a fix (I mean, it
made me wonder whether the prototypes were being used at all (they are)).

what say you?

cheerskinch
Dave Kinchlea        kinch@betty.csd.uwo.ca (reply will (should) work)
Computer Science Dept.
University of Western Ontario
London, Ontario, Canada
Technical Details
Message-ID: <OINK.92Jul26032212@julian.newshost.uwo.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!cs.utexas.edu!torn!newshost.uwo.ca!newshost.uwo.ca!oink

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!cs.utexas.edu!torn!newshost.uwo.ca!newshost.uwo.ca!oink
From: oink@newshost.uwo.ca (Test Account)
Subject: Function Prototypes: Don't they force casts?
Organization: The University of Western Ontario, London, Canada.
Date: Sun, 26 Jul 1992 08:22:12 GMT
Message-ID: <OINK.92Jul26032212@julian.newshost.uwo.ca>
Sender: news@julian.uwo.ca (USENET News System)
Nntp-Posting-Host: julian.uwo.ca
Lines: 34