Bad array indexing is considered deadly

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 1 11:00:33 PDT 2017


On 6/1/2017 2:53 AM, Vladimir Panteleev wrote:
> 3. Design your program so that it can be terminated at any point without 
> resulting in data corruption. I don't know if Vibe.d can satisfy this 
> constraint, but e.g. the ae.net.http.server workflow is to build/send the entire 
> response atomically, meaning that the Content-Length will always be populated. 
> Wrap your database updates in transactions. Use the "write to temporary file 
> then rename over the original file" pattern when updating files. Etc.

This is the best advice.

I.e. design with the assumption that failure will occur, rather than fruitlessly 
trying to prevent all failure.



More information about the Digitalmars-d mailing list