Rule 5.1 and case-sensitive - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.5 Identifers (https://forum.misra.org.uk/forumdisplay.php?fid=160) +---- Thread: Rule 5.1 and case-sensitive (/showthread.php?tid=1346) |
Rule 5.1 and case-sensitive - xiangke - 12-06-2017 Have a short description in example section of Rule 5.1: In the following non-compliant example, the implementation supports 6 significant case-insensitive characters in external identifiers. The identifiers in the two translation units are different but are not distinct in their significant characters. /* file1.c */ int32_t abc = 0; /* file2.c */ int32_t ABC = 0; Have another description In the following example, the definitions all occur in the same translation unit. The implementation in question supports 31 significant case-sensitive characters in external identifiers. /* 1234567890123456789012345678901********* Characters */ int32_t engine_exhaust_gas_temperature_raw; int32_t engine_exhaust_gas_temperature_scaled; /* Non-compliant */ Case-sensitive is mentioned here, I think it means that the following case is compliant /* file1.c */ int32_t abc = 0; /* file2.c */ int32_t ABC = 0; is it inconsistent? case-sensitive is implemented or supported for this rule ? Re: Rule 5.1 and case-sensitive - swestin - 14-06-2017 > is it inconsistent? case-sensitive is implemented or supported for this rule ? I believe the example you quote would comply with Rule 5.1 (distinctness), but violate Directive 4.5 (typographical ambiguity) Re: Rule 5.1 and case-sensitive - xiangke - 14-07-2017 Yes, You are right, I verify this point.The example comply with Rule 5.1 (distinctness), but violate Directive 4.5 (typographical ambiguity). Re: Rule 5.1 and case-sensitive - misra-c - 21-09-2017 The definition of the word "distinct" in rule 5.1 depends on the implementation in which the code is being compiled/linked. What is considered non-compliant with this rule will depend on the implementation under which the code is being developed, not the implementation of the analysis tool. The first example in the document (engine_exhaust_gas_temperature_raw) assumes an implementation which supports:
"abc" v "ABC" would be compliant with rule 5.1 if the implementation treated external identifiers as being case-sensitive. Note: "abc" and "ABC" will always be non-compliant with directive 4.5. |