M
mark
hi i read that u should always use sigaction() to install a signal handler
and never signal(), is this right and if so why. thanks.
and never signal(), is this right and if so why. thanks.
Richard Heathfield said:mark said:
If not, why not? Because signal() is universally available to hosted
implementations, whereas sigaction() is not.
Keith Thompson said:(I don't remember the details off the top of my head), so it can make
sense to use sigaction() rather than signal() *if* you don't mind the
loss of portability.
Gordon Burditt said:You have a loss of portability if there is or could be in the future
at least one non-POSIX C implementation. There are many more than
that.
Richard Heathfield said:mark said:
No.
If not, why not? Because signal() is universally available to hosted
implementations, whereas sigaction() is not.
Mark said:And there are a lot more ANSI C implementations then POSIX C ?
hi i read that u should always use sigaction() to install a signal handler
and never signal(), is this right and if so why. thanks.
It's an easy argument that among POSIX systems, sigaction() is *more*
portable than signal(), and between OSX, *BSD, Linux, and UN*X, that's a
lot of systems. (Perhaps another argument could be made that under
Windows signal() should not be used at all? I'm out of my element
there, though.) I don't mean to imply that All The World's A VAX, but I
do mean to imply that for any given platform, there's probably something
better than C99 signal().
Mark said:And there are a lot more ANSI C implementations then POSIX C ?
Erm, yes.
The one I use most regularly isn't POSIC, and doesn't provide
sigaction().
Keith Thompson said:Just out curiousity, is it a hosted implementation or a freestanding
implementation? If the later, it needn't necessarily provide signal()
either.
mark said:
No.
Excellent, comprehensive answers have been given in this thread by Beej
and "Nobody". Why don't you show a tiny bit of humility and learn from
what they've written, instead of parading your ignorance before the
world and wilfully misleading the OP?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.