checkedint call removal
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 2 08:19:11 PDT 2014
On 08/02/2014 05:08 PM, Andrei Alexandrescu wrote:
> On 8/2/14, 5:44 AM, Artur Skawina via Digitalmars-d wrote:
>> auto fx(ubyte* p, size_t len) @safe {
>> assert_(len>0);
>> if (len>=1)
>> return p[0];
>> return -1;
>> }
>
> As an aside I think it's a bug that this function passes @safe. It
> should not be able to safely dereference the pointer because it may be
> e.g. just past the end of the array. Has this been submitted as a bug?
> -- Andrei
>
So far I have been under the impression that dereferencing pointers in
@safe is intended to be ok, but creating pointers to inexistent data is
intended to be un- at safe.
More information about the Digitalmars-d
mailing list