Related articles |
---|
Strange C constructs vbdis@aol.com (2004-02-26) |
Re: Strange C constructs derek@NOSPAMknosof.co.uk (Derek M Jones) (2004-02-26) |
Re: Strange C constructs iddw@hotmail.com (2004-02-27) |
Re: Strange C constructs jeremy@jdyallop.freeserve.co.uk (Jeremy Yallop) (2004-02-27) |
Re: Strange C constructs alexc@std.com (Alex Colvin) (2004-02-27) |
Re: Strange C constructs derek@NOSPAMknosof.co.uk (Derek M Jones) (2004-03-02) |
Re: Strange C constructs david.thompson1@worldnet.att.net (Dave Thompson) (2004-03-02) |
Re: Strange C constructs vbdis@aol.com (2004-03-02) |
Re: Strange C constructs viz@pisem.net (Victor Zverovich) (2004-03-02) |
Re: Strange C constructs RLake@oxfam.org.pe (2004-03-06) |
[1 later articles] |
From: | Jeremy Yallop <jeremy@jdyallop.freeserve.co.uk> |
Newsgroups: | comp.compilers |
Date: | 27 Feb 2004 22:11:36 -0500 |
Organization: | University of Cambridge, England |
References: | 04-02-147 04-02-163 |
Keywords: | C |
Posted-Date: | 27 Feb 2004 22:11:36 EST |
Derek M Jones wrote:
>> Another question may be easier to answer:
>>
>> typedef int (procname)(int arg);
>>
>> According to K&R only /pointers/ to procedure-types can be constructed.
>
> Hang on. I thought you were a fan of standards?
>
>> Does there exist newer specs which allow to typedef procedures
>> themselves?
>
> If you mean C99, then no. If you mean vendor extensions, I cannot
> think of any.
Hmm? Function types can certainly be typedef-ed in C99 (and C89). I
do it quite often, in fact, since I dislike hiding the fact that
there's a pointer involved:
typedef void comparison_t(const void *, const void*);
void sort(void *sequence, size_t length, comparison_t *compare);
You can use any type in C typedef definitions; you can even say
typedef void object;
if you're so inclined.
Jeremy
Return to the
comp.compilers page.
Search the
comp.compilers archives again.