TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Category: Expressions

Synopsis:Rules about expressions


Description:
An expression is a sequence of operators and operands that specifies computation of a value, or that designates an object or a function, or that generates side effects, or that performs a combination thereof. The value computations of the operands of an operator are sequenced before the value computation of the result of the operator.

Coding Rules

NameCheckedSynopsis
6.5.a Checked automatically with code checker Bitwise operations shall only be applied on operands of unsigned type.
6.5.2.1.a Checked automatically with code checker Array subscripting requires a pointer to object type and one or more integral subscript expressions. The indices must be within the bounds values of the (allocated) array.
6.5.2.1.b typedef for an array of unknown size shall not be used.
6.5.2.2.b Checked automatically with code checker Do not declare functions within functions.
6.5.2.2.c Checked automatically with code checker Do not use functions marked as deprecated.
6.5.2.3.a Checked automatically with code checker When structures are accessed by means of a pointer, the pointer-to notation -> rather than the member notation * shall be used to denote a specified member of the structure.
6.5.2.3.b Checked automatically with code checker Structs or unions must be passed by reference into functions with variable numbers of parameters.
6.5.2.3.d Checked automatically with code checker Do not use nested structures.
6.5.3.1.a Checked automatically with code checker Do not mix postfix and prefix increment and/or decrement in a statement.
6.5.3.2.a Checked automatically with code checker A variable declared as an array shall not be used as a pointer.
6.5.3.3.a Checked automatically with code checker The unary plus operator shall not be used.
6.5.3.3.b Checked automatically with code checker Unary minus shall only be applied to an operand having a signed arithmetic type.
6.5.3.4.a Checked automatically with code checker sizeof shall not be applied to an expression with side-effects.
6.5.3.4.b Checked automatically with code checker Don't use sizeof on a variable of an array type that is passed as argument.
6.5.4.a Checked automatically with code checker Casting shall only be used to denote required casting.
6.5.7.b Checked automatically with code checker The right operand of a left shift operator for a signed type as left operand shall not be so large that the resulting value cannot be represented.
6.5.8.a Checked automatically with code checker Comparison of unsigned operands shall not occur against negative values.
6.5.8.c Checked automatically with code checker Don't compare floats of different types.
6.5.8.d Comparison of floating point numbers (float or double) shall preferably be avoided.
6.5.8.e Use memcmp only to compare arrays of scalar types.
6.5.8.f Checked automatically with code checker Do not compare floating point numbers with memcmp.
6.5.9.a Checked automatically with code checker Pointer comparison shall only be done for compatible pointer types.
6.5.9.b Checked automatically with code checker Floating point expressions shall not be compared using the "==", "!=" operators. Floating point expressions shall be compared using special functions.
6.5.13.a The right-hand operand of the "&&" or "||" operator shall not contain any side-effects.
6.5.15.a Checked automatically with code checker The second and third operand of a conditional expression of the conditional operator shall not contain side-effects.
6.5.16.a Checked automatically with code checker Do not use nested assignments.
6.5.16.b Checked automatically with code checker Do not discard const qualifiers in pointer assignments.
6.5.17.a Checked automatically with code checker The comma operator shall not be used.