As-if rule (original) (raw)

About DBpedia

The standard for the C++ programming language allows compilers for this language to apply any optimizing transformation to a program during compilation, provided that such optimizations make no change in the "observable behavior" of the program, as specified in the standard; this mostly means that any actions the program performs on its environment occur in the specified order. This rule is commonly referred to as the as-if rule.

Property Value
dbo:abstract The standard for the C++ programming language allows compilers for this language to apply any optimizing transformation to a program during compilation, provided that such optimizations make no change in the "observable behavior" of the program, as specified in the standard; this mostly means that any actions the program performs on its environment occur in the specified order. This rule is commonly referred to as the as-if rule. The rule has three main exceptions in which behavior-changing optimizations are permitted. The first is that programs exhibiting undefined behavior are exempt; since the observable behavior is not well-defined anyway, any transformation is valid. The other two exceptions concern the copying of objects, and are called copy elision and the return value optimization. The effect of the as-if rule depends on the specific compiler implementation. As an example, in the Microsoft C++ compiler, it causes omission of certain optimizations such as around calls to library functions, since such calls may cause input/output actions or accesses to memory locations marked volatile, and changes in the order of those change observable behavior. The as-if rule is not specific to C++; many other programming languages, including C, Rust, Go, Ocaml, etc. have a similar rule, to permit optimization (notably inlining). (en)
dbo:wikiPageID 39700922 (xsd:integer)
dbo:wikiPageLength 2499 (xsd:nonNegativeInteger)
dbo:wikiPageRevisionID 1111406105 (xsd:integer)
dbo:wikiPageWikiLink dbr:C++_standard dbr:Volatile_(computer_programming) dbr:Inline_expansion dbr:Input/output dbr:Compiler dbr:Rust_(programming_language) dbr:Go_(programming_language) dbr:Copy_elision dbr:Ocaml dbr:C++ dbr:C_(programming_language) dbr:Return_value_optimization dbc:C++ dbr:Microsoft_Visual_C++ dbr:Optimizing_compiler dbr:Undefined_behavior dbr:Programming_language dbr:Software_library dbr:Compiler_optimization dbr:Instruction_reordering
dbp:wikiPageUsesTemplate dbt:Mono dbt:More_citations_needed dbt:Reflist dbt:C++_programming_language dbt:Prog-lang-stub dbt:Compiler_optimizations
dcterms:subject dbc:C++
rdf:type owl:Thing dbo:Language schema:Language wikidata:Q315 wikidata:Q9143 dbo:ProgrammingLanguage
rdfs:comment The standard for the C++ programming language allows compilers for this language to apply any optimizing transformation to a program during compilation, provided that such optimizations make no change in the "observable behavior" of the program, as specified in the standard; this mostly means that any actions the program performs on its environment occur in the specified order. This rule is commonly referred to as the as-if rule. (en)
rdfs:label As-if rule (en)
owl:sameAs freebase:As-if rule wikidata:As-if rule https://global.dbpedia.org/id/eJW9
prov:wasDerivedFrom wikipedia-en:As-if_rule?oldid=1111406105&ns=0
foaf:isPrimaryTopicOf wikipedia-en:As-if_rule
is dbo:wikiPageWikiLink of dbr:Memory_ordering dbr:Copy_elision dbr:As_if
is foaf:primaryTopic of wikipedia-en:As-if_rule