08-02-2023, 08:00 AM
The A3-9-1 rule recommends to use integer types from <cstdint>, indicating the size and signedness, but the plain 'char' type does not have corresponding type in this library. It is possible to replace only explicit signed or unsigned 'char' types.
The example in A3-9-1 shows the declaration of the plain 'char' type as non-compliant. I understand that in this case the 'i6' variable is initialized by numerical value, so its type should be changed to int8_t. However, this is a different problem that is non-compiant with Rule M5-0-11 "The plain char type shall only be used for the storage and use of character values.". The plain 'char' type is used in AUTOSAR documentation in cases which are marked as compliant (for example Rule A5-1-1). I suppose that A3-9-1 should apply only to 'char' types declared explicitly as signed or unsigned and should not apply to plain 'char' types.
The example in A3-9-1 shows the declaration of the plain 'char' type as non-compliant. I understand that in this case the 'i6' variable is initialized by numerical value, so its type should be changed to int8_t. However, this is a different problem that is non-compiant with Rule M5-0-11 "The plain char type shall only be used for the storage and use of character values.". The plain 'char' type is used in AUTOSAR documentation in cases which are marked as compliant (for example Rule A5-1-1). I suppose that A3-9-1 should apply only to 'char' types declared explicitly as signed or unsigned and should not apply to plain 'char' types.