SunOS: 1; portability: 0
Wm E Davidsen Jr
davidsen at crdos1.crd.ge.COM
Tue Sep 26 00:11:00 AEST 1989
In article <880 at cirrusl.UUCP>, dhesi at sun505.UUCP (Rahul Dhesi) writes:
| For about ten years, signal() has been a function returning pointer to
| int. It worked, and we were all happily writing portable code.
Actually I think you mean "pointer to function returning int." Since
the value of the pointer to proc is used, and a pointer to any proc type
can hold the address of any other proc type, I don't see that the
question ever comes up. Your existing code will work fine, since the
declaration is in signal.h and you can still save the value returned by
signal in a variable declared
int (*sighold)();
without portability problems.
Some compilers may warn you about this but you can always say
sighold = (int (*)())signal(SIGALRM, myproc);
which is the correct ugly cast of types.
--
bill davidsen (davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon
More information about the Comp.unix.questions
mailing list