Page MenuHomeFreeBSD

cdefs(9): encourage __nodiscard over __result_use_check
ClosedPublic

Authored by brooks on Jun 26 2026, 12:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 24, 4:27 PM
Unknown Object (File)
Thu, Sep 24, 3:05 PM
Unknown Object (File)
Thu, Sep 24, 2:52 PM
Unknown Object (File)
Sun, Sep 13, 5:24 AM
Unknown Object (File)
Thu, Sep 10, 7:44 PM
Unknown Object (File)
Thu, Sep 10, 8:41 AM
Unknown Object (File)
Mon, Sep 7, 10:41 PM
Unknown Object (File)
Sun, Sep 6, 8:26 PM
Subscribers

Details

Summary

nodiscard is closer to (and sometimes expands to) nodiscard from
C23 and C++17 so prefer it to the homegrown
result_use_check.

When nodiscard does expand to nodiscard it must appear entierly
before the function declaration (or between the function name
and argument list) so relocate as appropriate. This differs from
attribute((warn_unused_result)) used by result_use_check which
is more flexible.

Sponsored by: DARPA, AFRL

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable