Re: Built-in unsafety in D

2010-03-12 Thread bearophile
Ellery Newcomer: > foreach(k; arr){ > k = something; > } > when k should have a ref attribute. I have found 2 bugs like that one in my code where 'arr' was an array of structs. Another related bug was, done 2 times in my code: void foo(string s) { s.length += 1; } Here outside foo the l

Re: Built-in unsafety in D

2010-03-12 Thread Ellery Newcomer
On 03/12/2010 07:46 AM, bearophile wrote: The bug was caused by: typedef unsigned Signal; It would be very nice to be able to know where unsafe comparisons are happening in your program without having to modify and recompile dmd. Another thing that bit me is foreach(k; arr){ k = s

Built-in unsafety in D

2010-03-12 Thread bearophile
This is a follow-up of this thread, and other older threads on this topic: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=104965 This is a nice article written in 2005 by Thomas Guest, "Built-in Type Safety?": http://www.artima.com/cppsource/typesafetyP.html