Changes between Initial Version and Version 1 of Ticket #293


Ignore:
Timestamp:
Dec 5, 2024, 10:09:20 AM (13 days ago)
Author:
ajbeach
Comment:

Hopefully this will make the connection between the two tickets clear. Someone can handle this at any time but there doesn't appear to be much need to do it except to enable safer typing of string literals.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #293 – Description

    initial v1  
    11A string literal (possibly enclosed in `{}`)[1] used to initialize an array is treated as a list initializer with the characters in the string (and sometimes the null terminator) as elements in the list. This needs some special handling to be fully handled, and currently there are no special cases to handle that.
    22
    3 This is currently working anyways because (I believe) both array types are decomposed into pointer types and it tries to assign the resulting pointers directly. This gets it to C which does do the special handling. It does become a problem if the type of the string changes[2].
     3This is a refactoring to unblock another ticket[2]. It appears to work currently works out without any special handling by decomposing both arrays to pointers. Making string literals mean it would try to initialize a pointer to mutable character from a pointer to constant characters, this is not allowed, but copying data to a mutable array from a constant arrray is.
    44
    55[1] https://en.cppreference.com/w/c/language/array_initialization