Exception Safe Programming

Saaa empty at needmail.com
Sun Feb 25 10:20:28 PST 2007

Maybe I still don't get it :/

I made this simple function (mostly stolen :)

void getPictureList(char[] dir, out char[][] files){
  files = std.file.listdir(dir, "*.png");

  foreach (d; files)
  //if(files.length < 12) throw new Exception("Not enough images 

When I uncomment the last line I get:
Error: pictures: The system cannot find the file specified.
(commented version doesn't generate any errors)

There are only 10 files so an exception should be trown, but not that one ! 
: )


I call the function in my main and at the end of my main there is:

  writefln("Press the 'any' key to quit");

Why isn't this run in the uncommented version?


More information about the Digitalmars-d-learn mailing list