digitalmars.D.learn - DMD 2.0 void[]
- nobody (15/15) Jun 18 2007 Hello,
- Deewiant (4/22) Jun 19 2007 const(void)[] buf, because "string" is const(char)[].
- Sean Kelly (4/25) Jun 19 2007 It shouldn't matter for an append operation unless the const array
Hello, import std.file; import std.stdio; int main() { string str1 = "Zeile 1\n", str2 = "Zeile 2 \n"; void[] buf; buf ~= str1; buf ~= str2; write("test_neu.txt",buf); return 0; } How must i change the line void[] buf ? I can make buf ~= str1.dup , but i didn't understand why dup in dmd 2.0 is needed. Thanks
Jun 18 2007
nobody wrote:Hello, import std.file; import std.stdio; int main() { string str1 = "Zeile 1\n", str2 = "Zeile 2 \n"; void[] buf; buf ~= str1; buf ~= str2; write("test_neu.txt",buf); return 0; } How must i change the line void[] buf ?const(void)[] buf, because "string" is const(char)[]. -- Remove ".doesnotlike.spam" from the mail address.
Jun 19 2007
Deewiant wrote:nobody wrote:It shouldn't matter for an append operation unless the const array contains class references. Though I suppose the current rule is more clear. SeanHello, import std.file; import std.stdio; int main() { string str1 = "Zeile 1\n", str2 = "Zeile 2 \n"; void[] buf; buf ~= str1; buf ~= str2; write("test_neu.txt",buf); return 0; } How must i change the line void[] buf ?const(void)[] buf, because "string" is const(char)[].
Jun 19 2007