C++ Logo

std-proposals

Advanced search

Re: [std-proposals] 回复: Proposal: Integer division/remainder/division-remainder functions with exception throwing behavior

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 30 Apr 2025 13:02:00 -0700
On Wednesday, 30 April 2025 10:35:11 Pacific Daylight Time Jan Schultke via
Std-Proposals wrote:
> A much more interesting proposal would be to change division by zero
> globally so that it throws instead of being UB. Maybe this could be a
> conditionally supported feature. Maybe it's something that should be
> implemented in a compiler first. Maybe it's already implemented somewhere,
> not sure.

You can already do that. Install a SIGFPE handler on Unix systems and a
vectored exception handler on Windows.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-04-30 20:02:05