◐ Shell
clean mode source ↗

attribute specifier sequence(seit C++11) – cppreference.com

Aus cppreference.com

<metanoindex/>

Stellt die Implementierung definiert Attribute für Typen, Objekte, Code, etc.

Original:

Introduces implementation-defined attributes for types, objects, code, etc.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[[attr]] [[attr1, attr2, attr3(args)]] [[namespace::attr(args)]] alignas_specifier

Erklärung

Attribute bilden die einheitlichen Standard Syntax für die Implementierung definiert Spracherweiterungen, wie die GNU und IBM Spracherweiterungen __attribute__((...)), Microsoft-Erweiterung __declspec(), etc.

Original:

Attributes provide the unified standard syntax for implementation-defined language extensions, such as the GNU and IBM language extensions __attribute__((...)), Microsoft extension __declspec(), etc.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Ein Attribut kann fast überall in der C + +-Programm verwendet werden, und kann auf fast alles angewandt werden: die Typen, Variablen, Funktionen, um Namen, um Code-Blöcke, die gesamte Übersetzung Einheiten, obwohl jedes einzelne Attribut ist nur gültig, wenn es wird durch die Implementierung erlaubt: [[probably(true)]] kann nur mit einem if verwendet werden, und nicht mit einer Klassendeklaration. [[omp::parallel()]] kann zu einem Code zu einem Block oder for Schleife gelten, aber nicht mit dem Typ int, etc.

Original:

An attribute can be used almost everywhere in the C++ program, and can be applied to almost everything: to types, to variables, to functions, to names, to code blocks, to entire translation units, although each particular attribute is only valid where it is permitted by the implementation: [[probably(true)]] can only be used with an if, and not with an class declaration. [[omp::parallel()]] can apply to a code block or to a for loop, but not to the type int, etc.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

In Erklärungen, können Attribute sowohl vor als auch unmittelbar nach dem Namen des Unternehmens, das erklärt, in welchem ​​Fall sie kombiniert werden angezeigt. In den meisten anderen Situationen, Attribute zu dem direkt vorausfahrenden Einheit gelten .

Original:

In declarations, attributes may appear both before and directly after the name of the entity that is declared, in which case they are combined. In most other situations, attributes apply to the directly preceding entity.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

alignas_specifier ist ein Teil des Attributs Spezifizierer Sequenz, obwohl es andere Syntax hat. Es kann vorkommen, wo die [[...]] Attribute und erscheinen mag mit ihnen (vorausgesetzt, es wird dort eingesetzt, wo alignas zulässig ist) mischen

Original:

alignas_specifier is a part of the attribute specifier sequence, although it has different syntax. It may appear where the [[...]] attributes appear and may mix with them (provided it is used where alignas is permitted)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Standard-Attribute

Nur die folgenden beiden Attribute werden von der C + +-Standard definiert. Alle anderen Attribute sind die Implementierung spezifischer .

Original:

Only the following two attributes are defined by the C++ standard. All other attributes are implementation-specific.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[[noreturn]]

Zeigt an, dass die Funktion nicht zurück.
Dieses Attribut gilt für Erklärungen nur dann funktionieren. Das Verhalten ist undefiniert, wenn die Funktion mit diesem Attribut tatsächlich zurückgibt.
The folgenden Standard-Funktionen besitzen dieses Attribut: std::_Exit, std::abort, std::exit, std::quick_exit, std::unexpected, std::terminate, std::rethrow_exception, std::throw_with_nested, std::rethrow_nested

Original:

Indicates that the function does not return.
This attribute applies to function declarations only. The behavior is undefined if the function with this attribute actually returns.
The following standard functions have this attribute: std::_Exit, std::abort, std::exit, std::quick_exit, std::unexpected, std::terminate, std::rethrow_exception, std::throw_with_nested, std::rethrow_nested

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[[carries_dependency]]

std::memory_order: Zeigt an, dass die Abhängigkeit Kette release-verbrauchen
breitet sich in und aus der Funktion, die der Compiler unnötigen Speicherplatz Zaun instructions.
This Attribut überspringen kann in zwei Situationen auftreten

1) es kann mit den Parameterdeklarationen einer Funktion oder Lambda-Ausdrücke gelten, in dem Fall zeigt, dass die Initialisierung des Parameters trägt Abhängigkeit in Lvalue-zu-R-Wert-Umwandlung dieses object.

2) Es kann an die Funktion Erklärung als Ganzes, in welchem ​​Fall es zeigt an, dass der Rückgabewert Abhängigkeit zu der Auswertung der Aufruf der Funktion Ausdruck führt zu .

Original:

Indicates that dependency chain in release-consume std::memory_order propagates in and out of the function, which allows the compiler to skip unnecessary memory fence instructions.
This attribute may appear in two situations:

1) it may apply to the parameter declarations of a function or lambda-expressions, in which case it indicates that initialization of the parameter carries dependency into lvalue-to-rvalue conversion of that object.

2) It may apply to the function declaration as a whole, in which case it indicates that the return value carries dependency to the evaluation of the function call expression.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Beispiel