我不明白在C99一些句子 [英] I can not understand some sentences in C99

查看:102
本文介绍了我不明白在C99一些句子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在previous和下一个序列点的对象应具有其之间
  由前pression评价修改最多一次存储的值。
  此外,前一个值是只读确定该值
  要被存储

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

什么是此外,前值应只读,以确定要存储的价值是什么意思?在C99,为什么 A [I +] = 1 是未定义的行为?

What does "Furthermore, the prior value shall be read only to determine the value to be stored" mean? In C99, why a[i++] = 1 is undefined behavior?

推荐答案

A [I +] = 1 定义(除非有其他原因被比测序未定义副作用:越界访问,或者未初始化的 I

a[i++] = 1 is defined (unless it has other reasons to be undefined than the sequencing of side-effects: out of bound access, or uninitialized i).

您的意思是 A [I +] =我,这是因为它读取未定义的行为 I 相同的序列之间点作为我++ ,它改变它。

You mean a[i++] = i, which is undefined behavior because it reads i between the same sequence points as i++, which change it.

的。此外,应仅读出的先前值,以确定该值将被存储的一部分是指 I = I + 1; 是允许的,虽然它读取从 I 和修改 I

The "Furthermore, the prior value shall be read only to determine the value to be stored" part means that i = i + 1; is allowed, although it reads from i and modifies i.

在另一方面, A [I] =(I = 1); 是不允许的,因为尽管写入 I 只有一次,从我不计算要存储的值。

On the other hand, a[i] = (i=1); isn't allowed, because despite writing to i only once, the read from i is not for computing the value being stored.

这篇关于我不明白在C99一些句子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆