I'm having trouble getting the Sparcworks 4.X compiler to compile
POSIX.1 signal handling code (an example is at the end of this message).
It appears that the sys/signal.h declaration for the sigaction struct
is in error, in that sigaction.sa_handler is declared as a void(*)()
rather than a void(*)(int).
As I understand it, this declaration works fine under "ANSI" or "standard"
C, but under C++ a () argument declaration is the SAME as (void), unlike
"ANSI" or "standard" C.
For now, I've "casted-away" this problem, but would like to have a cleaner
solution. Note that gcc and other compilers on other platforms do not
exhibit
this symptom.
**example.c:
#include <signal.h>
void signal_handler(int)
{
void funct()Quote:}
{
struct sigaction action;
action.sa_handler = signal_handler; /*ERROR: cannot assign void(*)(int)
to void(*)()*/
action.sa_handler = SIG_IGN; /*ERROR: cannot assign void(*)(int) to
void(*)()*/
- - - -Quote:}
**sys/signal.h:
struct sigaction {
int sa_flags;
union {
void (*_handler)();
} _funcptr;
#define sa_handler _funcptr._handlerQuote:};
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Open Port Technology