-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Rob Stewart Sent: 04 February 2016 10:46 To: boost@lists.boost.org Subject: Re: [boost] [smart_ptr] Interest in the missing smart pointer (that can target the stack)
On February 2, 2016 9:20:11 PM EST, Noah
wrote: On 2/2/2016 1:40 AM, Rob Stewart wrote:
It's a lot simpler than that: Trust the Programmer. That's been part of C and C++ from the start.
And that was a BIG mistake. Most programmers can't be trusted a millimeter (especially me).
By all means default construct with zero-initialization and provide a converting constructor from numeric types. That will provide the safety you're after. However, rather than prevent a not uncommon use case, just make that use case possible.
Surely, the root cause is failure to use *hardware* to detect 'failure-to-initialize' and 'out-of-range'. That's the only way this can be done efficiently. But the C/C++ languages designed that out - no access to status flags and no proper vectors/matrices. (and so the hardware hasn't been encouraged to do it well). So C/C++ like software is doomed to be inefficient and/or dodgy. That Robert has got few visible users suggests that most ordinary programmers just don't care. (There are a subset that have their own small world with rules and programmer checkers to reduce the risks). But I applaud his dogged persistence and support anything to get wider use. Paul --- Paul A. Bristow Prizet Farmhouse Kendal UK LA8 8AB +44 (0) 1539 561830