Feedback Thread: DIP 1039--Static Arrays with Inferred Length--Community Review Round 1

Tim tim.dlang at t-online.de
Wed Jan 6 16:42:27 UTC 2021


On Wednesday, 6 January 2021 at 09:23:34 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community 
> Review of DIP 1039, "Static Arrays with Inferred Length".

The DIP should specify if arrays of char, wchar or dchar will 
contain a terminating '\0' and if it is included in the length. 
One example from the DIP already does this for one case:
char[$] a1 = "cerise";              // OK, `$` is replaced with 
`6` at compile time

Will a1 have a terminating '\0' after the string, which is not 
not included in the length?
Will an array literal of characters like ['c', 'e', 'r', 'i', 
's', 'e'] behave the same?

The DIP would be very useful when porting C code to D, but a 
different behaviour for terminating '\0' could result in bugs.


More information about the Digitalmars-d mailing list