Re: Empty associative array crashes program

2013-04-02 Thread Steven Schveighoffer
On Tue, 02 Apr 2013 01:22:26 -0400, Maxim Fomin wrote: On Monday, 1 April 2013 at 23:56:08 UTC, Steven Schveighoffer wrote: No, AA's are not classes (which BTW have had that problem fixed), they are pImpl structs. The equals operator should check for null before comparing the contents.

Re: Empty associative array crashes program

2013-04-02 Thread Timothee Cour
thanks I didn't know... must've been buried in the specs somewhere... On Tue, Apr 2, 2013 at 12:10 AM, Jonathan M Davis wrote: > On Monday, April 01, 2013 23:44:43 Timothee Cour wrote: >> can we officially use >> >> assert(a); >> >> instead of >> >> assert(a !is null); >> >> (likewise with if(...

Re: Empty associative array crashes program

2013-04-02 Thread Jonathan M Davis
On Monday, April 01, 2013 23:44:43 Timothee Cour wrote: > can we officially use > > assert(a); > > instead of > > assert(a !is null); > > (likewise with if(...)) > > It seems to compile and work just fine, and is shorter. That depends on what a is. If it's an AA as in the OP, then yes, they s

Re: Empty associative array crashes program

2013-04-01 Thread Timothee Cour
can we officially use assert(a); instead of assert(a !is null); (likewise with if(...)) It seems to compile and work just fine, and is shorter.

Re: Empty associative array crashes program

2013-04-01 Thread Maxim Fomin
On Monday, 1 April 2013 at 23:56:08 UTC, Steven Schveighoffer wrote: No, AA's are not classes (which BTW have had that problem fixed), they are pImpl structs. The equals operator should check for null before comparing the contents. It is a valid bug. -Steve This argument can be applied to

Re: Empty associative array crashes program

2013-04-01 Thread Luís.Marques
On Tuesday, 2 April 2013 at 00:10:51 UTC, H. S. Teoh wrote: So reopen it. bearophile already did. I just wanted the dust to settle, to see if there was consensus about it being a bug.

Re: Empty associative array crashes program

2013-04-01 Thread H. S. Teoh
On Tue, Apr 02, 2013 at 01:57:14AM +0200, digitalmars-d-boun...@puremagic.com wrote: > On Monday, 1 April 2013 at 23:56:08 UTC, Steven Schveighoffer wrote: > >No, AA's are not classes (which BTW have had that problem fixed), > >they are pImpl structs. The equals operator should check for null > >

Re: Empty associative array crashes program

2013-04-01 Thread bearophile
Luís Marques: Baah, I had already closed the bug while cowering in shame! ;-) Don't be ashamed for mistakes like this. Bye, bearophile

Re: Empty associative array crashes program

2013-04-01 Thread Luís.Marques
On Monday, 1 April 2013 at 23:56:08 UTC, Steven Schveighoffer wrote: No, AA's are not classes (which BTW have had that problem fixed), they are pImpl structs. The equals operator should check for null before comparing the contents. It is a valid bug. Baah, I had already closed the bug while

Re: Empty associative array crashes program

2013-04-01 Thread Steven Schveighoffer
On Mon, 01 Apr 2013 19:12:52 -0400, Jonathan M Davis wrote: On Monday, April 01, 2013 22:32:01 =?UTF-8?B?Ikx1w61z?=.Marques @puremagic.com wrote: I added a bug to the database, because the following code results in a segfault (DMD v2.062, OS X 10.8.3, 64-bit): #!/usr/local/bin/rdmd @safe:

Re: Empty associative array crashes program

2013-04-01 Thread Luís.Marques
Oops, I knew that but totally forgot --;; I shouldn't spend so much time without using D *shame* Thanks!

Re: Empty associative array crashes program

2013-04-01 Thread Jonathan M Davis
On Monday, April 01, 2013 22:32:01 =?UTF-8?B?Ikx1w61z?=.Marques @puremagic.com wrote: > I added a bug to the database, because the following code results > in a segfault (DMD v2.062, OS X 10.8.3, 64-bit): > > #!/usr/local/bin/rdmd > > @safe: > > void main() > { > int[string] a; > a["foo"] = 0;

Empty associative array crashes program

2013-04-01 Thread Luís.Marques
I added a bug to the database, because the following code results in a segfault (DMD v2.062, OS X 10.8.3, 64-bit): #!/usr/local/bin/rdmd @safe: void main() { int[string] a; a["foo"] = 0; a.remove("foo"); assert(a != null); // segfault (not except