Assignment and sequence points: how is this ambiguous?

后端 未结 6 984
礼貌的吻别
礼貌的吻别 2021-01-21 08:46

Consider the C code a = a = a. There\'s no sequence point for assignment, so this code produces a warning when compiling about an undefined operation on a

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-21 09:41

    int a = 42;
    a = a = a;
    

    is undefined behavior.

    Sequence point rules were written to ease the work of compiler makers.

提交回复
热议问题