S
Shao Miller
Would anyone use a '_FuncRetType' operator, described briefly, below?
Where the 'type-name' syntax would be extended to include:
type-name:
...
_FuncRetType ( type-name )
_FuncRetType identifier
Where 'identifier' would have to have been declared as a function type.
Where the '_FuncRetType' operator would yield a 'type-name' that is the
same type as the return type of either:
- A function whose type is the 'type-name' operand
- The function designated by the 'identifier' operand
Then you might do:
/* Like 'int x;' */
_FuncRetType (int(void)) x;
or:
int foo(void);
/* Like 'int x;' */
_FuncRetType foo x;
or:
typedef int f_int_no_args(void);
/* Like 'int x;' */
_FuncRetType(f_int_no_args) x;
or:
/* Third-party-provided version1.h */
/* Might be present as 'version.h' */
int my_func(void);
/* Third-party-provided version2.h */
/* Might be present as 'version.h' */
long long int my_func(void);
/* user.c */
#include "version.h"
typedef _FuncRetType my_func rt_my_func;
/* Like 'int x;' */
rt_my_func x;
x = my_func();
Where the 'type-name' syntax would be extended to include:
type-name:
...
_FuncRetType ( type-name )
_FuncRetType identifier
Where 'identifier' would have to have been declared as a function type.
Where the '_FuncRetType' operator would yield a 'type-name' that is the
same type as the return type of either:
- A function whose type is the 'type-name' operand
- The function designated by the 'identifier' operand
Then you might do:
/* Like 'int x;' */
_FuncRetType (int(void)) x;
or:
int foo(void);
/* Like 'int x;' */
_FuncRetType foo x;
or:
typedef int f_int_no_args(void);
/* Like 'int x;' */
_FuncRetType(f_int_no_args) x;
or:
/* Third-party-provided version1.h */
/* Might be present as 'version.h' */
int my_func(void);
/* Third-party-provided version2.h */
/* Might be present as 'version.h' */
long long int my_func(void);
/* user.c */
#include "version.h"
typedef _FuncRetType my_func rt_my_func;
/* Like 'int x;' */
rt_my_func x;
x = my_func();