All pastes #821716 Raw Edit

static typing example

public cpp v1 · immutable
#821716 ·published 2007-12-18 08:49 UTC
rendered paste body
---A---void MakeImage(t_image_size w, t_image_size h, t_image_bpp bpp, t_jpg_quality q, string name) { ...  make_image(w,h,bpp); ... image -> encode(jpg, q); image -> save(name); ...}---B---bool MakeBanner(t_image_size w, t_image_size h, string baseName) { // return success  try {    MakeImage(w,h,16,50, baseName+"_fast");    MakeImage(w,h,24,99, baseName+"_good");  } catch(...) { return 0; }  return 1;}---C---MakeBanner(640, 480, "test");MakeBanner("asdf", 480, "test"); // <-- this bug is detected ALWAYSif (rand()%1000 ==0) MakeBanner(99999999, 480, "test"); // <-- this bug is detected on run time (corner case)