Opened 2 weeks ago

Last modified 13 days ago

#293 new defect

String Initialization Cases

Reported by: ajbeach Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description (last modified by ajbeach)

A 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.

This 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.

[1] https://en.cppreference.com/w/c/language/array_initialization
[2] https://cforall.uwaterloo.ca/trac/ticket/210

Change History (1)

comment:1 Changed 13 days ago by ajbeach

Description: modified (diff)

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.

Note: See TracTickets for help on using tickets.