mesos-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bannier (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MESOS-7410) Make it harder to ignore errors returned from functions.
Date Fri, 21 Apr 2017 13:12:04 GMT

     [ https://issues.apache.org/jira/browse/MESOS-7410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benjamin Bannier updated MESOS-7410:
------------------------------------
    Component/s: stout

> Make it harder to ignore errors returned from functions.
> --------------------------------------------------------
>
>                 Key: MESOS-7410
>                 URL: https://issues.apache.org/jira/browse/MESOS-7410
>             Project: Mesos
>          Issue Type: Improvement
>          Components: stout
>            Reporter: Benjamin Bannier
>
> Mesos (or more specifically stout) uses a number of types which can capture either a
value or an error (e.g., {{Try}} or {{Result}}). These are used similar to exceptions, but
in contrast to exceptions, the possible errors are part of the function's types. It is also
possible to (implicitly) ignore errors return from functions producing such values (this is
not possible with exceptions).
> C\+\+11 introduced a generalized syntax for attributes which makes it possible to add
attributes to types. C++17 standardized an attribute {{nodiscard}} which
> {quote}
> Appears in a function declaration, enumeration declaration, or class declaration. If
a function declared nodiscard or a function returning an enumeration or class declared nodiscard
by value is called from a discarded-value expression other than a cast to void, the compiler
is encouraged to issue a warning.
> {quote}
> With that it is possible to annotate types with a {{nodiscard}} attribute which was not
possible with e.g., GNU attributes, e.g.,
> {code}
> class [[nodiscard]] Try;
> {code}
> We should annotate our error types with {{nodiscard}} to make sure errors are not missed.
> This will likely require updating call sites to handle currently ignored return values
(this appears more widespread in users of e.g., {{os::close}} or {{os::sleep}}). Since compilers
might emit errors for unknown attributes we should also prevent breaking a build on compilers
not supporting this attribute.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message