J
Jens Schweikhardt
hello, world\n
looking at FreeBSD's <sys/signal.h> I came across this fragment:
#define SIG_ERR ((__sighandler_t *)-1)
...
typedef void __sighandler_t(int);
and I started to wonder what the typedef meant. It's not typedefing
an alias for a function pointer, that would look like
typedef void (*func_ptr)(int);
so it apparently is an alias for a function. Compiled with gcc the
sizeof(__sighandler_t) is 1, while the sizeof(func_ptr) is 8. I can
declare an object of type __sighandler_t but I can't assign to it,
because functions can't be assigned to, only function pointers can.
It appears the only use of such a typedef-name is in casts and
declarators. Is that correct?
Regards,
Jens
looking at FreeBSD's <sys/signal.h> I came across this fragment:
#define SIG_ERR ((__sighandler_t *)-1)
...
typedef void __sighandler_t(int);
and I started to wonder what the typedef meant. It's not typedefing
an alias for a function pointer, that would look like
typedef void (*func_ptr)(int);
so it apparently is an alias for a function. Compiled with gcc the
sizeof(__sighandler_t) is 1, while the sizeof(func_ptr) is 8. I can
declare an object of type __sighandler_t but I can't assign to it,
because functions can't be assigned to, only function pointers can.
It appears the only use of such a typedef-name is in casts and
declarators. Is that correct?
Regards,
Jens