Project

General

Profile

Actions

Bug #3123

closed

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

Analyse Logiscope LFR_3.2.0.21 : LFR_basic-parameters : 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 n'est pas respectée dans 122 cas d'après Logiscope:
basic_parameters.h : lines 81, 94, 114, 123, 124, 127, 128, 144, 165, 174, 175, 178, 179, 196, 201, 202, 203, 211, 212, 215, 219, 239, 241, 251, 268, 270, 281, 295, 313, 319, 339, 349, 365, 376, 378, 382, 400, 423, 429, 456, 466, 481, 520, 552, 554, 555, 562, 563, 570, 572, 573, 580, 581, 587, 589, 590, 597, 598, 604, 606, 607, 614, 615, 621, 623, 624, 631, 632, 638, 640, 641, 648, 649, 655, 657, 658, 665, 666, 672, 674, 675, 682, 683, 689, 691, 692, 699, 700, 706, 708, 709, 716, 717, 750, 759, 760, 763, 764, 775, 795, 804, 805, 808, 809, 820, 840, 849, 850, 853, 854, 865, 886, 895, 896, 899, 900, 911, 931, 940, 941, 945, 946


Files

basic_parameters.h (65.3 KB) basic_parameters.h bruno katra, 09/10/2018 01:36 PM
Actions

Also available in: Atom PDF