Project

General

Profile

Bug #3125

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 almost 3 years ago. Updated almost 3 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))

History

#1 Updated by bruno katra almost 3 years ago

  • Status changed from New to In Progress

Salut Alexis !
Voici ma proposition pour la modif après les échanges que j'ai eu avec William sur l'application des règles...

cpu_load = (unsigned char) (CONST_255 - ((((ival*CONST_10) + (fval/CONST_100))*CONST_256)/CONST_1000));

#2 Updated by William Recart almost 3 years ago

Je confirme que la proposition de Bruno est OK pour Logiscope.

#3 Updated by Alexis Jeandet almost 3 years ago

  • Parent task set to #3120

#4 Updated by Alexis Jeandet almost 3 years ago

  • Status changed from In Progress to Resolved

Corrigé dans la r399

#5 Updated by William Recart almost 3 years ago

  • Status changed from Resolved to Closed

Corrected in source code V3.2.0.24

Also available in: Atom PDF