C++ Logo

std-proposals

Advanced search

Re: std::as

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Tue, 27 Oct 2020 10:46:02 +0100
Il 26/10/20 21:59, Ryan P. Nicholl via Std-Proposals ha scritto:
> I would still prefer std::as over std::get_unchecked though, because I
> don't think you should have to explicitly opt-in to zero overhead
> behavior. The difference is philosophical though, calling it
> "get_unchecked" accomplishes the same purpose with no runtime overhead.
> I don't really want to be typing "unsafe"/"unchecked" everywhere, that's
> for C# programmers. :)

I would wager that you don't have to opt-in anything; such an
optimization has to get enabled by default, and broken code has to opt
out. This is how similar optimizations have been shipped in the past.

(Besides, there is already this optimization in GCC:
-fdelete-null-pointer-checks, enabled by -O2. This is really a missed
optimization.)

Thanks,
-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2020-10-27 04:46:10