• i = ++i + i;


    In C99  --- 6.5 Expressions

    Between the previous and next sequence point an object shall have its stored value
    modified at most once by the evaluation of an expression. Furthermore, the prior value
    shall be read only to determine the value to be stored

    2. Between the previous and next sequence point an object shall have its stored valuemodified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.

    3. The grouping of operators and operands is indicated by the syntax. Except as specified later (for the function-call (), &&, ||, ?:, and comma operators), the order of evaluation of subexpressions and the order in which side effects take place are both unspecified

    In C++ ISO/IEC 14882:2003 --- 5 Expressions

    4. Except where noted, the order of evaluation of operands of individual operators and subexpressions of individual expressions, and the order in which side effects take place, is unspecified.53) Between the previous and next sequence point a scalar object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored.The requirements of this paragraph shall be met for each allowable ordering of the subexpressions of a full expression; otherwise the behavior is undefined.

     

    So undefined:

    i = v[i++];

    i = ++i + 1;

    while allowing

    i = i + 1;

    a[i] = i;

  • 相关阅读:
    c#冒泡排序
    C# 虚方法(virtual)覆盖(override) 隐藏(new) 重载
    Javascript 大括号
    C# const.static.readonly.
    热点链接(img map area)
    WeiBo返回错误码的二种方式
    Cookie跨域操作
    synchronized(this)与synchronized(class)
    线程安全场景备忘
    git新建一个分支setupstream
  • 原文地址:https://www.cnblogs.com/aoaoblogs/p/1748103.html
Copyright © 2020-2023  润新知