Function typedefs have any use?
Gabriel Dos Reis
gdr@integrable-solutions.net
Mon Feb 7 03:45:00 GMT 2005
"Kevin P. Fleming" <kpfleming@starnetworks.us> writes:
| Gabriel Dos Reis wrote:
|
| > I guess "pointless" is in the eye of beholder. I've used that ability
| > quite a lot in some projects, where a large number of functions
| > sharing the same prototype has to be declared.
|
| But you still had to repeat the prototypes when defining the
yes. And I did not find it terribly annoying, compared to what I
would have to come up with.
| functions, so it did not provide as much benefit as it could... the
| declarations automatically change when you modify the typedef, but the
| function definitions don't.
|
| > Care to make a concrete proposal? There is no point in complaining
| > if you can't improve over the situation...
|
| Sure, how would I go about doing that? Obviously it would be a GCC
| extension only, but I think it could be useful.
|
| Something as simple as:
|
| typedef char *f_t(char, char, void *);
|
| f_t f;
|
| f(p1, p2, p3)
But, now this looks like an old-style function definition, except that
the type of the parameters are not provided -- so you would have to
make sure that you do not introduce a parsing ambiguity!
If you believe you have a solution that actually works, then you have
the choice between:
(1) writing a formal proposal and contact the ISO C commitee;
(2) writing a formal proposal and convince the GNU C maintainers
that your proposal worths adding to GNU C, and work out the
details with them.
-- Gaby
More information about the Gcc-help
mailing list