Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Christmas Quiz 2022 Date: Tue, 27 Dec 2022 13:53:55 -0800 Organization: None to speak of Lines: 33 Message-ID: <87pmc4pl70.fsf@nosuchdomain.example.com> References: <354067d8-9199-4090-b6c5-68910515d642n@googlegroups.com> <5a4dcd63-491a-ca9a-a742-06c5b974935e@niles.xyz> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="0af59a5445f55bd00f3cbbbd179e58cb"; logging-data="3923378"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WwlXxxr9ZCNc7N2FboY8p" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:S6cM25URUpIs7R+e46S7riRF1hE= sha1:n6xC06P0Midh4TTClMU8rRG2WYA= Xref: csiph.com comp.lang.c:168669 scott@slp53.sl.home (Scott Lurndal) writes: > James Kuyper writes: >>On 12/27/22 04:22, Niles Rogoff wrote: >>> On 12/18/22 13:18, Tony Oliver wrote: >>>> Signal SIGFPE is raised. >>> >>> What happens to programs running on systems that don't support signals? :^) >> >>The only answer that fits all systems is that the behavior is undefined. >>Singe the FP in SIGFPE stands for floating point, and the question was >>about dividing an int value by 0, raising SIGFPE seems rather odd, but >>it's certainly not prohibited. > > Notwithstanding the "FP" in the name, SIGFPE isn't specific to floating > point. > > https://pubs.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html > > > SIGFPE - Erroneous arithmetic operation. True, but not particularly relevant. It's true that on *some* implementations, in some circumstances, integer division by 0 can result in a SIGFPE (on my system, it does so at optimization levels 0 and 1, and raises SIGILL at levels 2 and 3, with the simple example I tried). But the question purported to be about the C language, which does not define the behavior of integer division by zero. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */