C Programming Language Note (11) Reference manual 3

Source: Internet
Author: User
Tags class operator

7 expressions
The precedence and binding of operators are clearly defined, except in a few cases, that the order of evaluation of an expression is not superfluous, and even some sub-expressions with side effects are not first, that is, unless the definition of an operator guarantees that its operands are evaluated in a particular order, the specific implementation is free to choose any order of evaluation, You can even change the order of evaluation However, the way in which each operator combines the values produced by its operands with the syntax parsing of the expression is compatible with the C language does not define an overflow in the expression evaluation process, Division checking and handling of other exceptions most existing C language implementations ignore overflow exceptions when evaluating and assigning signed integer expressions, and can sometimes be adjusted with nonstandard library functions

  

7.1 Pointer generation
Corresponds to a type T if the type of an expression or sub-expression is an array of type T

The value of this expression is a pointer to the first object in the array, and the type of the expression is converted to a pointer to type T if the expression is a unary operator & or sizeof, no conversion is made. Similarly, unless an expression is used as an operand of the & operator, an expression of the type "function that returns a value of type T" will be converted to the "pointer to a function that returns a value of type T" type

  

7.2 Elementary Expressions
An elementary expression includes an expression that identifies a constant string or parentheses

  

7.3 Suffix expression
Operators in Postfix expressions follow a left-to-right binding rule suffix expression [] (argument list). Member---member ++--array reference function call struct reference suffix self increment decrement

  

7.4 Unary operators
An expression with a unary operator follows a right-to-left binding suffix expression + + expression--expression coercion type conversion sizeof unary unary expression sizeof (type name) unary Operator: & * +-! Prefix increment operator self-decrement operator address operator & indirection operator * Unary plus operator unary minus operator binary inverse code operator ~ logical non-operator! The sizeof operator sizeof operator computes the number of bytes required to store an object of the same type as its operand, either as an evaluated expression or as a type with parentheses, and when sizeof is used for char, the result is 1 for the array. When the total number of bytes in an array is used for structs and unions, the result is that the number of bytes of the object includes any padding space required by the array contained in the object this operator cannot be used for function types and operands of incomplete types, nor for bit field structures to be an unsigned integer constant  size_t

  

7.5 Coercion of type conversions
(type name) type conversion expression

  

7.6 Multiplication class Operators
Multiplication operators */and% follow left-to-right binding

  

7.7 Addition class operator 7.8 shift operator
The Shift-class operators << and >> follow left-to-right binding for each operator must be integral, and the type that follows the integer promotion principle is the type of the promoted left operand if the right operand is negative or is greater than the number of bits of the type that is equal to the left operand, the result is undefined

  

7.9 Relational operators
Relational operations follow a left-to-right binding, but this rule has nothing to do with a<b<c parsing will be parsed to  (a<b) <c, and the result of A<b can only be 0 or 1 for a relational expression with a false value of 0 and a true value of 1

  

7.10 Equality class operators
The equality operator has the same rules as the relational operator, but this type of operator also allows execution: the pointer can be compared with a constant integer expression of 0 or a pointer to void

 

7.11 Bitwise AND operator

7.12 Bitwise XOR Operator 7.13 bitwise OR operator 7.14 logic and operator 7.15 logical OR operator 7.16-bar operator 7.17 Assignment expression 7.18 comma-operator 7.19 constant-expression

C Programming Language Note (11) Reference manual 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.