On Friday, 16 August 2024 at 11:37:08 UTC, Nick Treleaven wrote:

```d
// use a fixed array:
immutable char[60] a = '-';
string s = a.dup; // copy to heap, assuming you need the data to escape (use a[] otherwise)
s.writeln();


This seems to work without having to make a string dup. I just wanted to write a separator line in my output. Is there anything wrong with using
the char[60] directly?


        import std.stdio;

        immutable char[60] a = '-';

        void main() {
          a.writeln();
        }


Reply via email to