Deutsch English Français Italiano |
<vugo19$m2n2$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Thiago Adams <thiago.adams@gmail.com> Newsgroups: comp.lang.c Subject: Re: integer divided by zero Date: Fri, 25 Apr 2025 16:32:57 -0300 Organization: A noiseless patient Spider Lines: 31 Message-ID: <vugo19$m2n2$1@dont-email.me> References: <vughb7$g6cm$1@dont-email.me> <87selwoydy.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 25 Apr 2025 21:32:57 +0200 (CEST) Injection-Info: dont-email.me; posting-host="798e28d3c2d66a0e3e88ddd606249bea"; logging-data="723682"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Katjbo4qV1ne7FjKZuZ3/HKHRpxmmJVw=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:8/yR8s79zI1KQ7y+R8N/Mzkv19I= In-Reply-To: <87selwoydy.fsf@nosuchdomain.example.com> Content-Language: en-GB Bytes: 1879 Em 4/25/2025 4:05 PM, Keith Thompson escreveu: > Thiago Adams <thiago.adams@gmail.com> writes: >> Does anyone know of any platform where integer division by zero >> returns a number, or in other words, where it's not treated as an >> error? I'm asking because division by zero is undefined behaviour, but >> I think division by a constant zero should be a constraint instead. > > Division by a constant zero is a constraint violation in a context that > requires a constant expression. Consider this sample int main(){ int a[1/0]; } 1/0 does not have a value in compile time, So I believe compilers are making "a" a VLA because 1/0 is not constant. (But what old c89 compilers where doing in this case?) This sample is a motivation to make integer divided by zero a constrain.