Y
Hacker News
new
|
ask
|
show
|
jobs
by
listeria
138 days ago
may I introduce you to the nodiscard attribute[1]?
enum (class)? [[nodiscard]] Error { Ok, NoMem, ... };
[1]:
https://en.cppreference.com/w/cpp/language/attributes/nodisc...
1 comments
drysine
138 days ago
C attribute: nodiscard (since C23)
[1]
https://en.cppreference.com/w/c/language/attributes/nodiscar...
link
senderista
138 days ago
FWIW I’ve been using warn_unused_result in both gcc and clang since about 2020.
link
drysine
136 days ago
Yep, partial remedies are available for quite some time.
link