array initialization, is referencing a previous element ok?

前端 未结 4 1904
耶瑟儿~
耶瑟儿~ 2020-12-11 16:26
const QPointF points[] =
{
    QPointF(r.left() - i, r.top() - i),
    QPointF(r.right() + i, r.top() - i),
    QPointF(r.right() + i, r.bottom() + i),
    QPointF(r         


        
4条回答
  •  眼角桃花
    2020-12-11 17:16

    Since there is no sequence point in the statement, the result is undefined, much like for the i=i++ example quoted at that wikipedia page.

    Otherwise said, nothing specifies, whether the compiler should first evaluate everything, then assign, or do evaluate-assign for each element separately and in which order.

提交回复
热议问题