473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Signalhandler and "-ansi -pedantic -Wall"

Hi,

I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
catches the first signal but ignores the others. The installed handler
seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?

thx a lot for your answers in advance !
May 31 '07 #1
8 2336
On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <as*@me.atwrote:
>Hi,

I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
catches the first signal but ignores the others. The installed handler
seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?

thx a lot for your answers in advance !
Off topic here. You should ask in a forum for the platform you're
working on, comp.unix.programmer, at a guess. As another guess, you
should probably be re-issuing the signal() in the handler. OTOH, you
probably should really be using sigaction() <g>. Go ask the experts in
comp.unix.programmer.

--
Al Balmer
Sun City, AZ
May 31 '07 #2
Al Balmer wrote:
On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <as*@me.atwrote:
>>Hi,

I've got a problem. I wrote a Program with a Signalhandler Routine. If i
use the compile flags "-ansi -pedantic -Wall", "(void)
signal(SIGCHLD,Handler)" catches the first signal but ignores the others.
The installed handler seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?

thx a lot for your answers in advance !

Off topic here. You should ask in a forum for the platform you're
working on, comp.unix.programmer, at a guess. As another guess, you
should probably be re-issuing the signal() in the handler. OTOH, you
probably should really be using sigaction() <g>. Go ask the experts in
comp.unix.programmer.
thx and sorry for the offtopic post
May 31 '07 #3
In article <46***********************@newsreader02.highway.te lekom.at>,
Simon Klein <as*@me.atwrote:
>I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
Compile flags are not specified by the C standard, so to find out
more about which compile flags you should use and what their effects
are, you should consult with a newsgroup that deals with your toolchain.
It appears that you are using gcc, so one of the gnu.* newsgroups
would seem most appropriate.

>catches the first signal but ignores the others. The installed handler
seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?
<OT>

I dunno. But signal semantics have changed over the years. One
of the older common signal() semantics is that signals do not
automatically rearm; if you are using such a system, then you
have to reissue the signal() before leaving the signal handler.

As to why it happens with those flags but not without them --
well, possibly not having to rearm is an extension and -ansi
is requesting that extensions not be used. Or there might be
some other reason for it; ask in an appropriate newsgroup.
--
All is vanity. -- Ecclesiastes
May 31 '07 #4
On May 31, 5:26 pm, Al Balmer <albal...@att.netwrote:
On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <a...@me.atwrote:
Hi,
I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
catches the first signal but ignores the others. The installed handler
seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?
thx a lot for your answers in advance !

Off topic here. You should ask in a forum for the platform you're
working on, comp.unix.programmer, at a guess. As another guess, you
should probably be re-issuing the signal() in the handler. OTOH, you
probably should really be using sigaction() <g>. Go ask the experts in
comp.unix.programmer.
signal() is ansi C, isn't it?

By the way, the manpage seems to indicate that if you compile with
different defines, different semantics are used. I suppose removing
the -ansi changes the defines and allows the use of another semantic
than the one of ansi C.

May 31 '07 #5
In article <11*********************@p77g2000hsh.googlegroups. com>,
Quentin Godfroy <qu*************@hotmail.comwrote:
>On May 31, 5:26 pm, Al Balmer <albal...@att.netwrote:
>On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <a...@me.atwrote:
>I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
>signal() is ansi C, isn't it?
SIGCHLD is not.
--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton
May 31 '07 #6
On May 31, 5:39 pm, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
On May 31, 5:26 pm, Al Balmer <albal...@att.netwrote:
On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <a...@me.atwrote:
I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
signal() is ansi C, isn't it?

SIGCHLD is not.
Whoops. Sorry for the mess.

May 31 '07 #7
On 31 May 2007 14:36:39 -0700, Quentin Godfroy
<qu*************@hotmail.comwrote:
>On May 31, 5:26 pm, Al Balmer <albal...@att.netwrote:
>On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <a...@me.atwrote:
>Hi,
>I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
catches the first signal but ignores the others. The installed handler
seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?
>thx a lot for your answers in advance !

Off topic here. You should ask in a forum for the platform you're
working on, comp.unix.programmer, at a guess. As another guess, you
should probably be re-issuing the signal() in the handler. OTOH, you
probably should really be using sigaction() <g>. Go ask the experts in
comp.unix.programmer.

signal() is ansi C, isn't it?
Yes, but the re-arming behavior is implementation defined. I don't
know whether POSIX defines it.
>
By the way, the manpage seems to indicate that if you compile with
different defines, different semantics are used. I suppose removing
the -ansi changes the defines and allows the use of another semantic
than the one of ansi C.
--
Al Balmer
Sun City, AZ
May 31 '07 #8
Al Balmer <al******@att.netwrites:
On Thu, 31 May 2007 23:01:02 +0200, Simon Klein <as*@me.atwrote:
>>I've got a problem. I wrote a Program with a Signalhandler Routine. If i use
the compile flags "-ansi -pedantic -Wall", "(void) signal(SIGCHLD,Handler)"
catches the first signal but ignores the others. The installed handler
seems to be gone after the first run.
If I remove the "-ansi -pedantic -Wall" flags, everything works just fine.
But why?

Off topic here.
.... because the C standard doesn't specify what happens to the
handling of a signal when a signal handler is invoked. Both behaviors
you're seeing are consistent with what the C standard specifies.
(It's deliberately vague so that varying existing behaviors are
permitted.)
You should ask in a forum for the platform you're
working on, comp.unix.programmer, at a guess. As another guess, you
should probably be re-issuing the signal() in the handler. OTOH, you
probably should really be using sigaction() <g>. Go ask the experts in
comp.unix.programmer.
Yes, but first read your system's documentation for the signal
function. <OT>On Unix-like systems, there may be multiple man pages
for "signal"; "man man" if you don't already know how to find the one
you need.</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
May 31 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johan | last post by:
Hi, Does anyone know where I can find a c++ class for signal handler under unix thanks Johan
5
by: jacob navia | last post by:
Due to popular demand (specially from Mr Heathfield), I have introduced a -pedantic compiler flag, that will be as the -ansic option but stricter. This flag will make _stdcall
22
by: Frederick Gotham | last post by:
Is it not inefficient to have allowed "free" to accept a null pointer? Would it not have been better to disallow it, and to provide an auxiliary function for times when its wanted: #define...
2
by: Mack | last post by:
Hi Guys, I am working on Linux C++ using Gcc3.4.6 to make files and make project run. When i make(compile file) it says pedantic errors so what error is this exactly?? I think this error is...
15
by: new to c | last post by:
Hi! I write this code cos.c #include <math.h> #include <stdio.h> int main(void) { double c;
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.