I'd vote for option 2, which is visually less distracting and still
communicates the same thing (in the end, it's a function qualifier).

On Fri, Jan 6, 2017 at 2:59 PM, Tim Armstrong <[email protected]> wrote:
> Hi All,
>   I wanted to poll the Impala community for opinions about style for
> declaring functions where the caller is expected to do something with the
> return value.
>
> Ideally we'd be able to declare Status with an attribute that made this
> take effect globally, but unfortunately that's not available until C++17.
>
> So we need to annotate each Status-returning function. The two alternatives
> we discussed on this CR (https://gerrit.cloudera.org/#/c/4878/) were:
>
> #1 - a special macro wrapping Status
>
> MUST_USE(Status) DoSomethingThatCanFail(int64_t foo, Bar* bar);
>
> Pros:
> * Closely connected to the return type that it affects
> * It's easier to search/replace Status with MUST_USE(Status)
>
> Cons:
> * Could get visually noisy if we use it everywhere
>
> #2 - a macro that gets appended to the declaration:
>
> Status DoSomethingThatCanFail(int64_t foo, Bar* bar) WARN_UNUSED_RESULT;
>
> Pros:
> * Macro is slightly
> * Less visually noisy since it's at the end of the declaration
>
> What do people think?

Reply via email to