On 07.07.2023 23:10, Stefano Stabellini wrote:
> On Fri, 7 Jul 2023, Jan Beulich wrote:
>> On 07.07.2023 00:46, Stefano Stabellini wrote:
>>> --- a/docs/misra/rules.rst
>>> +++ b/docs/misra/rules.rst
>>> @@ -203,6 +203,13 @@ maintainers if you want to suggest a change.
>>>       - The lowercase character l shall not be used in a literal suffix
>>>       -
>>>  
>>> +   * - `Rule 7.4 
>>> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
>>> +     - Required
>>> +     - A string literal shall not be assigned to an object unless the
>>> +       objects type is pointer to const-qualified char
>>> +     - Assigning a string literal to any object with type
>>> +       "pointer to const-qualified void" is allowed
>>
>> I guess this is relevant also in a few other cases: Considering the
>> significant difference between title and actual text of the rule, and
>> further assuming people looking here won't always pull out the full
>> doc (they may not even have a copy of it), I think it is important to
>> also mention in a remark that despite the title all "character types"
>> are permitted, as long as string element type and character type match.
>> Since the compiler won't allow mismatches when the lhs type isn't void,
>> mandating no use of casts to "satisfy" the rule may be a way to express
>> our intentions.
> 
> What about:
> 
>    * - `Rule 7.4 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_04.c>`_
>      - Required
>      - A string literal shall not be assigned to an object unless the
>        objects type is pointer to const-qualified char
>      - All "character types" are permitted, as long as the string
>        element type and the character type match. (There should be no
>        casts.) Assigning a string literal to any object with type
>        "pointer to const-qualified void" is allowed.

SGTM.

Jan

Reply via email to