On 30 January 2015 at 16:04, Savolainen, Petri (NSN - FI/Espoo)
<petri.savolai...@nsn.com> wrote:
>>
>> I don't think these use cases can be supported unless we define that
>> ODP calls must detect INVALID handles and handle them in a
>> well-defined manner. The question is which calls, perhaps all of them.
>
> To me "undefined behavior" is crash or return error. That should be the goal 
> for implementers anyway.
Undefined behavior may in practice look like successful behavior. E.g.
an implementation using pointers for handles will probably succeed
even when passed an "invalid" handle, e.g. a handle which is still a
valid pointer but it does not point to a valid object (e.g. could be
an already freed object). Depending on the operation, reading or
writing data based on that pointer will still succeed. You are lucky
if invoking undefined behavior causes a crash because program
termination is immediate and you will be able to debug the problem if
you get a core dump.

>
> Implementation has basically two options
> - use pointer as handle and access that without checking it => crash
> - use index as handle: fast to check it and return error, or map the table 
> memory so that invalid handle cause page miss and crash.
>
> Third, option would be to successfully use invalid handles/pointers into 
> memory and return success for any random handles, but I would not use that 
> implementation for production...
>
> -Petri
>

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to