Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > typedef func *func();

Reply
Thread Tools

typedef func *func();

 
 
Till Backhaus
Guest
Posts: n/a
 
      12-13-2006
Hi comp.lang.c,

sorry for the subject of this message not being valid c, anyway this
is the shortest and cleanest way to describe my problem.
To put in other words:
I'm searching for a way to declare functions that return function
pointers of it's own type.
(Yes, I know of void-pointers, I just don't wan't loose type-checking if
I don't have to.)

Cheers,
Till Backhaus
 
Reply With Quote
 
 
 
 
Richard Bos
Guest
Posts: n/a
 
      12-13-2006
Till Backhaus <> wrote:

> sorry for the subject of this message not being valid c, anyway this
> is the shortest and cleanest way to describe my problem.
> To put in other words:
> I'm searching for a way to declare functions that return function
> pointers of it's own type.


Not possible.

> (Yes, I know of void-pointers, I just don't wan't loose type-checking if
> I don't have to.)


They'd have been useless to you anyway.

Read the FAQ: <http://c-faq.com/decl/recurfuncp.html>.

Richard
 
Reply With Quote
 
 
 
 
Till Backhaus
Guest
Posts: n/a
 
      12-13-2006
In article <>,
(Richard Bos) wrote:

> Read the FAQ: <http://c-faq.com/decl/recurfuncp.html>.
>
> Richard


That was pretty fast! Thank you so much!
 
Reply With Quote
 
dcorbit@connx.com
Guest
Posts: n/a
 
      12-13-2006
Till Backhaus wrote:
> Hi comp.lang.c,
>
> sorry for the subject of this message not being valid c, anyway this
> is the shortest and cleanest way to describe my problem.
> To put in other words:
> I'm searching for a way to declare functions that return function
> pointers of it's own type.
> (Yes, I know of void-pointers, I just don't wan't loose type-checking if
> I don't have to.)
>
> Cheers,
> Till Backhaus


Maybe RTTI in C++ would help. There is nothing like that in C.

What exactly is the problem you are trying to solve? Maybe there is a
simple solution in the C language from anther track.

 
Reply With Quote
 
Jack Klein
Guest
Posts: n/a
 
      12-14-2006
On Wed, 13 Dec 2006 16:33:47 +0100, Till Backhaus <>
wrote in comp.lang.c:

> Hi comp.lang.c,
>
> sorry for the subject of this message not being valid c, anyway this
> is the shortest and cleanest way to describe my problem.
> To put in other words:
> I'm searching for a way to declare functions that return function
> pointers of it's own type.
> (Yes, I know of void-pointers, I just don't wan't loose type-checking if
> I don't have to.)
>
> Cheers,
> Till Backhaus


Can't be done directly. Can be done using a structure with a function
pointer as its only member. Return an instance of the structure.

Coding is rather icky and left as an exercise to the reader, with the
hint that typedef comes in handy.

See http://c-faq.com/decl/recurfuncp.html in the FAQ, how did you miss
it?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
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
func() in implementation and func (100, 200, 300) in calling Alex Vinokur C Programming 6 11-18-2006 08:08 AM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
difference between import from mod.func() and x=mod.func() Hari Sekhon Python 0 06-20-2006 08:07 AM
What's the difference between built-in func getattr() and normal call of a func of a class Johnny Python 3 08-23-2005 08:28 AM
int func() v/s int func(void) Vinko Vrsalovic C Programming 14 01-24-2005 08:07 AM



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