Re: (New idea) Resizing an array: Dangerous? Possibly buggy?

2011-03-11 Thread Jonathan M Davis
On Friday 11 March 2011 21:40:36 %u wrote: > >> I think pitfalls like this one (with the garbage collector, for example) > >> should definitely be documented somewhere. I would imagine that quite a > >> few people who try to set the length of an array > > won't realize that they can run out of mem

Re: (New idea) Resizing an array: Dangerous? Possibly buggy?

2011-03-11 Thread %u
>> I think pitfalls like this one (with the garbage collector, for example) >> should definitely be documented somewhere. I would imagine that quite a few >> people who try to set the length of an array won't realize that they can run out of memory this way, especially because it's nondeterminis

Re: Resizing an array: Dangerous? Possibly buggy?

2011-03-11 Thread Nick Treleaven
On Wed, 09 Mar 2011 18:15:42 +, %u wrote: > I think pitfalls like this one (with the garbage collector, for example) > should definitely be documented somewhere. I would imagine that quite a > few people who try to set the length of an array won't realize that they > can run out of memory this

Re: Resizing an array: Dangerous? Possibly buggy?

2011-03-09 Thread %u
Huh, interesting, okay. I think pitfalls like this one (with the garbage collector, for example) should definitely be documented somewhere. I would imagine that quite a few people who try to set the length of an array won't realize that they can run out of memory this way, especially because it's

Re: Resizing an array: Dangerous? Possibly buggy?

2011-03-09 Thread Steven Schveighoffer
On Wed, 09 Mar 2011 06:41:54 -0500, %u wrote: Increasing the sizes of an array has always given me the shivers, as beautiful as it is. Since dmd around 2.042, array resizing and memory management has been extremely safe. It should be very difficult for you to get into trouble. Could so

Resizing an array: Dangerous? Possibly buggy?

2011-03-09 Thread %u
Increasing the sizes of an array has always given me the shivers, as beautiful as it is. Could someone explain why this code behaves the way it does? string s = "1234"; s.length = 7; writefln("\"%s\"", s); prints: "1234���" Given that it makes no sense to extend a const-size array,