🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50636

Re: gcc2.4.5 and function's typedefs

#50636
From: D. Erway
Date: Fri, 27 Aug 1993 16:58
41 lines
2106 bytes
In article <55192@sophia.inria.fr>, Lionel Mallet <mallet@gaia.inria.fr> wrote:
>Assume the following C file (foo.c):
>#include <X11/Intrinsic.h>
>XtCallbackProc foo(Widget w, XtPointer client_data, XtPointer call_data)
>{
>	/* nothing inside */
>}
>When compiling this code with gcc -Wall I get the following message:
>mallet@skye% gcc -c -v -Wall foo.c
>foo.c: In function `foo':
>foo.c:6: warning: control reaches end of non-void function
>But in fact my function *IS* declared as returning void as the XtCallbackProc 
>type is a typedef of this kind:
>typedef void (*XtCallbackProc)(
>#if NeedFunctionPrototypes
>    Widget              /* widget */,
>    XtPointer           /* closure */,  /* data the application registered */
>    XtPointer           /* call_data */ /* callback specific data */
>#endif
>);

So foo() is returning an XtCallbackProc, which is definitely not
equivalent to void. foo() is returning a pointer to a function
that returns void.

I think what you mean is:

void foo(Widget w, XtPointer client_data, XtPointer call_data) {
}

XtCallbackProc bar = foo;

	-Don

\-----------------------------------------------------------------------/
| Don Erway			   			 derway@ndc.com	|
| NDC Systems								|
| Monrovia, CA			   Opinions expressed herein apparently	|
| (Somewhere Near Pasadena)	   spontaneously organized  themselves.	|
/-----------------------------------------------------------------------\
Technical Details
Message-ID: <25lef0INNrt7@gap.caltech.edu>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!news.claremont.edu!nntp-server.caltech.edu!derway
References: <55192@sophia.inria.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,d8aff1ea61eb00c8
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-08-27 10:26:31 PST
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!news.claremont.edu!nntp-server.caltech.edu!derway
From: derway@cco.caltech.edu (D. Erway)
Newsgroups: gnu.gcc.help
Subject: Re: gcc2.4.5 and function's typedefs
Date: 27 Aug 1993 16:58:08 GMT
Organization: California Institute of Technology, Pasadena
Lines: 43
Message-ID: <25lef0INNrt7@gap.caltech.edu>
References: <55192@sophia.inria.fr>
NNTP-Posting-Host: alumni.caltech.edu