The reason we added V8_WARN_UNUSED_RESULT was that ignoring an exception
will lead to lots of unexpected and hard to debug behavior. This annotation
helps embedders to not miss any place where you have to check for an
exception.

On Fri, Jun 3, 2016 at 7:27 PM Ben Noordhuis <i...@bnoordhuis.nl> wrote:

> On Fri, Jun 3, 2016 at 7:02 PM, Mark Logan <m...@artillery.com> wrote:
> > I'm migrating some code to v8 5.0.71 (node v6.1.0), and replacing
> deprecated
> > calls to ForceSet with DefineOwnProperty/CreateDataProperty.
> >
> > I'm a little confused as to why V8_WARN_UNUSED_RESULT is present in these
> > declarations, when it wasn't present for ForceSet. Is there some new
> reason
> > why I should not ignore the return value? Or, is ignoring the return
> value
> > from DefineOwnProperty (or CreateDataProperty) no more dangerous than it
> was
> > to ignore the return value from ForceSet?
> >
> > Thanks,
> > Mark
>
> I believe V8_WARN_UNUSED_RESULT didn't exist when ForceSet() was
> added.  Ignoring the return value is probably no more dangerous, but:
>
> 1. DefineOwnProperty() fails when you try to set a property with a
> setter that throws an exception.
>
> 2. CreateDataProperty() and DefineOwnProperty() fail when the target
> object is not configurable, not extensible, frozen or sealed.
>
> IOW, there are quite a few failure modes.  You almost always want to
> check whether the operation succeeded and did what you thought it did.
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to