$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-05 13:38:14
Andrey Semashev wrote:
> What is the practical advantage of using span (of any provider) over the
> traditional pointer+size? I emphasize the "practical" part, as opposed to any
> personal preference to "modern-ness", code style or anything like that.
The practical advantage is that if a library is rewritten to use spans
throughout, and never pointer arithmetic, this (a) automatically adds
bounds checks everywhere and (b) makes the library warning-free under
the new -Wunsafe-buffer-usage, which is all the rage nowadays because
Chromium developers are rewriting Chromium as above.
https://clang.llvm.org/docs/SafeBuffers.html
Longer term, it's quite likely that a memory safety "Profile" (Profiles are
also all the rage nowadays because they are Bjarne and Herb's proposal
to "solve" safety) will be essentially equivalent to -Werror=unsafe-buffer-usage
as far as pointer arithmetic is concerned.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3081r0.pdf