public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* extern "C" and prototyping question
@ 1998-04-30  5:23 Bjørn Wennberg
  0 siblings, 0 replies; 2+ messages in thread
From: Bjørn Wennberg @ 1998-04-30  5:23 UTC (permalink / raw)
  To: 'egcs@cygnus.com'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

Hi there!

I have a problem getting the following code snip to compile:

extern "C" {
   void set_CB(void (*func)());
}

void exit_handler() {}

int main()
{
	set_CB(exit_handler);
}
+++++

When compiling this with egcs-1.0.3-prerelease I get
warning: ANSI C++ prohibits conversion from `()' to `(...)'

If I do compile with -pedantic, the warning goes away. What is wrong
here?

bjornw>

------------------------------------------------------------------------
------------------------------------
Bjørn Wennberg                                               email:
bw@lcc.no
Development Engineer, CellAD System 7       phone: +47 6797 8800
LCC Europe                                                         fax:
+47 6797 8801


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: extern "C" and prototyping question
@ 1998-05-01  3:55 Brad M. Garcia
  0 siblings, 0 replies; 2+ messages in thread
From: Brad M. Garcia @ 1998-05-01  3:55 UTC (permalink / raw)
  To: Bjorn.Wennberg; +Cc: egcs

Change your set_CB declaration to:

extern "C" {
    void set_CB(void (*func)(void));
}

And everything will be fine.

Brad Garcia
   ___/  __ /  __ /  ___/ "Being the Linux of digital media
  __/   /  /  / _/  __/    would be a very good life."
_/    ____/ _/ _| ____/      - Jean-Louis Gassee, CEO of Be, Inc.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-05-01  3:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-30  5:23 extern "C" and prototyping question Bjørn Wennberg
1998-05-01  3:55 Brad M. Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).