Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to interpret this declaration

Reply
Thread Tools

How to interpret this declaration

 
 
Mark
Guest
Posts: n/a
 
      07-15-2005
"Yohji" <> wrote in message
news: oups.com...
> wrote:
>> I found the following declaration in some header file.
>> Can somebody help me how to interpret this ?
>> void (*signal( int sig, void (*function)(int)) (int) );
>> Thanx for any help in advance ....

> Hmm,it is a little difficult.The signal functions is one of POSIX.


Not POSIX, ISO 7.14.1.1


 
Reply With Quote
 
 
 
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      07-15-2005
pete wrote on 15/07/05 :
> Emmanuel Delahaye wrote:
>>
>> Kenneth wrote on 15/07/05 :
>>> void (*signal( int sig, void (*function)(int))) (int);

>>
>> This is a case where typedefs are useful
>>
>> typedef int signal_f (int);
>>
>> signal_f signal (int sig, signal_f * function);

>
> That gives my compiler an error:
> error C2091: function returns function
>
> This compiles OK:
> typedef int (*signal_f) (int);
> signal_f signal (int sig, signal_f * function);


No. The right code is:

typedef int (*signal_f) (int);
signal_f signal (int sig, signal_f function);

or

typedef int signal_f (int);
signal_f *signal (int sig, signal_f *function);

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
maxplusII error: a deferred constant declaration without a full declaration is not supported Noah VHDL 5 04-07-2006 02:34 PM
"virtual outside class declaration" and "declaration does not declare anything" kelvSYC C++ 6 05-17-2005 08:58 AM
Function declaration in class declaration Ovidesvideo C++ 4 12-10-2004 06:36 PM
Intel C++ 8.0 : declaration hides declaration Alex Vinokur C++ 4 04-05-2004 09:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57