Project

General

Profile

Actions

Bug #3125

closed

Task #3120: Livraison sources 3.2.0.21 pour analyse Logiscope // W. Recart

Analyse Logiscope LFR_3.2.0.21 : Tr_Parenthèses Severity is Medium

Added by William Recart over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
-
Start date:
03/10/2018
Due date:
% Done:

0%

Estimated time:
revision:
r0

Description

Rappel de la règle :
Tr_Parenthèses
Definition:
-----------
In expressions, every binary and ternary operator has to be put in parenthesis,
so that the evaluation priorities are not ambiguous.
Use the partpar option to allow the following rules: when the right operand of
a + or * operator uses the same operator, you can omit parenthesis for it.
In the same way, you can omit parenthesis in the case of the right operand of an
assignment operator. Moreover, you can omit parenthesis at the first level of
the expression.

Parameters:
----------
The character string "partpar", which, if used, allows programmers not to put
systematically parenthesis, according to the rule above.

Justification:
--------------
Removes ambiguity about the evaluation priorities.

Example:
--------

// do not write
result = fact / 100 + rem;

// write
result = ((fact / 100) + rem);

// or write, with the partpar option
result = (fact / 100) + rem;

// with the partpar option, write
result = (fact * ind * 100) + rem + 10 + (coeff ** c);

// instead of
result = ((fact * (ind * 100)) + (rem + (10 + (coeff ** c))));

La règle est non respectée et non couverte par la RPW-MEB-LFR-RFW-00257-LPP accepted in DP R3++ :
lfr_cpu_usage_report.c line 60 : cpu_load = (unsigned char)(CONST_255 - ((ival*CONST_10+fval/CONST_100)*CONST_256/CONST_1000))

Actions

Also available in: Atom PDF