~/talk

Better Code with C++ Attributes

Talkat CppCon 2019 · 2019-09-15..09-20· [compilers-and-language-design]
name:Ben Saks
links:none on file
slides:none on file

Explains concrete attributes and their effects: [[noreturn]] prevents return-path code generation and avoids unreachable-code surprises but causes undefined behavior if the function actually returns; [[deprecated]]("use write") emits migration warnings with custom messages; [[fallthrough]] suppresses unwanted fallthrough warnings; [[maybe_unused]] suppresses assert-driven unused-parameter noise; [[nodiscard]] for error codes helps catch ignored returns; [[no_unique_address]] to shrink objects lets empty policy members share padding and can reduce a struct from 12 to 8 bytes; C++20 also adds [[likely]]/[[unlikely]] branch hints.

AI-written summary · about

  1. 0:00Introduction to Attributes
  2. 48:03Advanced Attribute Usage
  3. 53:42Portability and Best Practices
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.