Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
July 27, 2010 [Issue 4521] New: accepts-invalid Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4521 Summary: accepts-invalid Array-wise assignment on unallocated array is accepted Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-07-27 11:46:44 PDT --- The following code should raise an out of bounds error: import std.stdio; void main() { double[] c; c[] = 4; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 4521] accepts-invalid Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4521 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nfxjfg@gmail.com --- Comment #1 from nfxjfg@gmail.com 2010-07-27 22:37:00 PDT --- Maybe I'm missing something, but no it should not. "c[] = 4;" just sets every array element to 4, and it works even if there are 0 array elements. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 4521] Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4521 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid CC| |clugdbug@yahoo.com.au Summary|accepts-invalid Array-wise |Array-wise assignment on |assignment on unallocated |unallocated array is |array is accepted |accepted --- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-07-27 23:57:22 PDT --- (In reply to comment #1) > Maybe I'm missing something, but no it should not. > "c[] = 4;" just sets every array element to 4, and it works even if there are 0 > array elements. Yes. Some related situations are definitely bugs though. Perhaps this one should be marked as a duplicate of bug 2547. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 4521] Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4521 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #3 from bearophile_hugs@eml.cc 2010-07-28 04:19:38 PDT --- This is not a bug, I think this can be closed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 4521] Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4521 --- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-07-28 05:55:29 PDT --- But isn't there a difference between arrays that had all of their elements removed and arrays that have not yet been allocated in the first place? I filed it since Walter seems to have confirmed this: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=114041 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 4521] Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4521 --- Comment #5 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-07-28 06:38:07 PDT --- Actually I think I'm confusing myself with how dynamic allocation works. I thought the dynamic array always have to be called with new, but it appears I can change the length of an array without calling new in the first place, e.g.: int[] a; a.length = 4; a[] = 4; writeln(a); // writes 4 4 4 4 So this should probably get closed. Sorry for the confusion. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 28, 2010 [Issue 4521] Array-wise assignment on unallocated array is accepted | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4521 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation