版本1和3间的区别 (跳过第2版)
于2007-07-18 22:22:18修订的的版本1
大小: 1341
编辑: czk
备注:
于2008-02-23 15:36:59修订的的版本3
大小: 1401
编辑: localhost
备注: converted to 1.6 markup
删除的内容标记成这样。 加入的内容标记成这样。
行号 1: 行号 1:
## page was renamed from TCPL/A.7.3.3 Structure References

A.7.3.3 Structure References

A postfix expression followed by a dot followed by an identifier is a postfix expression. The first operand expression must be a structure or a union, and the identifier must name a member of the structure or union. The value is the named member of the structure or union, and its type is the type of the member. The expression is an lvalue if the first expression is an lvalue, and if the type of the second expression is not an array type.

A postfix expression followed by an arrow (built from - and >) followed by an identifier is a postfix expression. The first operand expression must be a pointer to a structure or union, and the identifier must name a member of the structure or union. The result refers to the named member of the structure or union to which the pointer expression points, and the type is the type of the member; the result is an lvalue if the type is not an array type.

Thus the expression E1->MOS is the same as (*E1).MOS. Structures and unions are discussed in Par.A.8.3.

  • In the first edition of this book, it was already the rule that a member name in such an expression had to belong to the structure or union mentioned in the postfix expression; however, a note admitted that this rule was not firmly enforced. Recent compilers, and ANSI, do enforce it.

TCPL/A.07.03.3_Structure_References (2008-02-23 15:36:59由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.