On Monday, 18 November 2019 at 13:28:26 UTC, Adam D. Ruppe wrote:
But it is rare and if you aren't specifically looking for it
knowing the details, it isn't right. And since the syntax looks
so normal it trips up a LOT of people.
I think the compiler should probably start to error on it, and
On Monday, 18 November 2019 at 12:42:26 UTC, Adam D. Ruppe wrote:
My guess is the compiler is seeing a static string and
incorrectly putting it in the read-only segment with the other
strings, and then writing to it thus triggers that segfault.
Yeah, that appears to be what's happening. For
Hi! Can anybody explain why this snippet segfaults when I try to
run it:
char[] array = new char[5];
void main()
{
array[0] = 'a';
}
It works fine if I move the array into main, or (strangely) if I
change its type to ubyte[] instead of char[], or if I merely read
the array without
On Thursday, 29 August 2019 at 19:06:04 UTC, kinke wrote:
Sorry, that was wrt. the linked bugzilla and not this example
here. - What does work is `static double[6][3] matrix = [0, 0,
0]`, i.e., initializing each nested 1D array with a scalar 0.
I guess I'll use this workaround, though
Hey, everybody! I'm having Array Problems™. The documentation on
arrays says that you can initialize all elements of a rectangular
array with the following syntax:
double[6][3] matrix = 0; // Sets all elements to 0.
However this doesn't appear to work for static initialization:
static