Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/language/attributes/likely"

From cppreference.com
< cpp‎ | language‎ | attributes
m (notes)
m (T. Canens moved page cpp/attribute/likely to cpp/language/attributes/likely without leaving a redirect: Text replace - "cpp/attribute" to "cpp/language/attributes")

Revision as of 07:44, 24 June 2018

Template:cpp/attribute/title Template:cpp/attribute/navbar

Allow the compiler to optimize for the case where paths of execution including that statement are more or less likely than any alternative path of execution that does not include such a statement

Syntax

[[likely]] statement (1)
[[unlikely]] statement (2)

Explanation

1) Applies to a statement to allow the compiler to optimize for the case where paths of execution including that statement are more likely than any alternative path of execution that does not include such a statement.
2) Applies to a statement to allow the compiler to optimize for the case where paths of execution including that statement are less likely than any alternative path of execution that does not include such a statement.

Example