Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      As-if rule

      From cppreference.com
      <c‎ |language
       
       
       
       

      Allows any and all code transformations that do not change the observable behavior of the program.

      [edit]Explanation

      The C compiler is permitted to perform any changes to the program as long as the following remains true:

      1) At everysequence point, the values of allvolatile objects are stable (previous evaluations are complete, new evaluations not started).
      (until C11)
      1) Accesses (reads and writes) tovolatile objects occur strictly according to the semantics of the expressions in which they occur. In particular, they arenot reordered with respect to other volatile accesses on the same thread.
      (since C11)
      2) At program termination, data written to files is exactly as if the program was executed as written.
      3) Prompting text which is sent to interactive devices will be shown before the program waits for input.
      4) If the pragma#pragma STDC FENV_ACCESS is supported and is set toON, the changes to thefloating-point environment (floating-point exceptions and rounding modes) are guaranteed to be observed by the floating-point arithmetic operators and function calls as if executed as written, except that
      • the result of any floating-point expression other than cast and assignment may have range and precision of a floating-point type different from the type of the expression (seeFLT_EVAL_METHOD),
      • notwithstanding the above, intermediate results of any floating-point expression may be calculated as if to infinite range and precision (unless#pragma STDC FP_CONTRACT isOFF).
      (since C99)

      [edit]Notes

      This section is incomplete
      Reason: fill out similar tocpp/language/as_if

      [edit]See also

      C++ documentation foras-if rule
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/language/as_if&oldid=154654"

      [8]ページ先頭

      ©2009-2025 Movatter.jp