Project

General

Profile

Actions

Bug #809

closed

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

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

Status:
Closed
Priority:
Low
Category:
-
Target version:
-
Start date:
19/10/2016
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 75 cas d'après Logiscope:
Fichier avf0_prc0.c : ligne 378
Fichier avf1_prc1.c : ligne 370
Fichier avf2_prc2.c : ligne 256
Fichier fsw_misc.c : lignes 374, 705, 706, 707
Fichier fsw_processing.c : lignes 236, 549, 556, 584, 585, 587, 651, 654, 658, 664, 668, 702, 782, 783
Fichier fsw_processing.h : lignes 280, 283, 286, 306, 309
Fichier fsw_spacewire.c : lignes 162, 167, 267, 1586
Fichier tc_acceptance.c : lignes 223, 274
Fichier tc_handler.c : lignes 279, 365, 382, 970, 1037, 1407, 1413, 1416, 1519, 1549
Fichier tc_load_dump_parameters.c : lignes 403, 408, 417, 422, 431, 436, 462, 467, 551, 555, 559, 867, 885, 999, 1000, 1353, 1365, 1367, 1514
Fichier tm_lfr_tc_exe.c : ligne 380
Fichier wf_handler.c : lignes 113, 843, 905, 906, 1170, 1184, 1185, 1208, 1209, 1231, 1233, 1266, 1277

Actions

Also available in: Atom PDF