[Prev][Next][Index]
sage confused by complicated function type
- To: sage-bugs@extreme.indiana.edu
- Subject: sage confused by complicated function type
- Date: Tue, 25 Apr 1995 14:59:45 -0700
- From: Lars Thomas Hansen <lth@cs.uoregon.edu>
- Sender: owner-sage-bugs@extreme.indiana.edu
The pc++ barfs at this:
#if (defined ( __STDC__ ) || defined ( __cplusplus ))
/* So I can write ansi prototypes and still use Sun cc */
#define _FN_DECL(type_and_name, args) type_and_name args
#else
#define _FN_DECL(type_and_name, args) type_and_name()
#endif
typedef int ilu_boolean, ilu_private, ilu_IOHandler, ilu_FineTime;
_FN_DECL(ilu_boolean ilu_AddRegisterersToDefault,
(ilu_boolean(*reg_inp) (int fd,
ilu_IOHandler handler,
ilu_private rock),
ilu_boolean(*can_inp) (int fd),
ilu_boolean(*reg_out) (int fd,
ilu_IOHandler handler,
ilu_private rock),
ilu_boolean(*can_out) (int fd),
void (*set_alarm) (ilu_FineTime t,
void (*proc) (ilu_FineTime t)),
void (*can_alarm) (void)
));
main()
{
}
with the error message:
blackrabbit(429) % pc++ bug.pc
Error on line 22 of bug.pc: Old K&R style declaration, unexpected bif form, or undefine variables
Error in pc++ while executing:
-------> pC++2dep TEMP_pC++.C
but is happy with the following equivalent code:
#if (defined ( __STDC__ ) || defined ( __cplusplus ))
/* So I can write ansi prototypes and still use Sun cc */
#define _FN_DECL(type_and_name, args) type_and_name args
#else
#define _FN_DECL(type_and_name, args) type_and_name()
#endif
typedef int ilu_boolean, ilu_private, ilu_IOHandler, ilu_FineTime;
typedef ilu_boolean (*reg_t) ( int, ilu_IOHandler, ilu_private );
typedef ilu_boolean (*can_t) ( int );
_FN_DECL(ilu_boolean ilu_AddRegisterersToDefault,
(reg_t reg_inp,
can_t can_inp,
reg_t reg_out,
can_t can_out,
void (*set_alarm) (ilu_FineTime t, void (*proc) (ilu_FineTime t)),
void (*can_alarm) (void)
));
main()
{
}
No biggie, since I can work around it.
--lars